July 18, 2014 | Python |
I have been reading Miller & Ranum's e-book on Python/Algorithms. (A superb book which is also free online.) While looking through their chapter on Algorithm Analysis, I took their idea of using the Python
timeit methods a bit forward to create a simple plotting scheme using
Here is the code. You can add in your own function here and plot the time complexity.
The code is quite simple. Perhaps the only interesting thing here is the use of
partial to pass in the function and the
N parameter into
Here is the output.
Have fun! ;-)
We love hearing from our readers. Email us at firstname.lastname@example.org for questions or comments on this article. If you found this article useful, please support us by buying some of our Open Source hardware products - like ZeroDriver - an Arduino Zero compatible motor driver for robotics. ZeroDriver is crowdfunding right now. Please click here to support our campaign. and bring this product to market!