There you can find some algorithms that developed by me when I was reading the book "Grokking Algorithms" by Aditya Bhargava. Inside it you can see some different with book as source, but I think that I adapt them well.
Inside search.py you can find the following algorithms that can find item (in list of 10_000_000 elements) by time after dash:
- Stupid (simple) search - 0.90677571s
- Binary search - 0.00001287s
- Python search - 0.25032830s
Obviosly, binary search is better of algorithms above. But you can execute that youself and check speed and iterations count with your computer and numbers just for fun =)
As well inside sort.py are following algorithms of sorting list of 5_000 elements (also each one provided with execution time):
- Choice sort - 0.46786356s
- Quick sort - 0.01690745s
- Python sort - 0.00043821s
In file graph.py I provided search algorithms to work with graphs. See below.
- Breadth First Search (+ function that is trying to find shortest path without weights)
- Djikstra Algorithm