title: How does one calculate the runtime of an algorithm?
body: <p>I've read about algorithm run-time in some algorithm books, where it's expressed as, <code>O(n)</code>. For eg., the given code would run in O(n) time for the best case &amp; O(n<sup>3</sup>) for the worst case. What does it mean &amp; how does one calculate it for their own code? Is it like linear time , and is it like each predefined library function has their own run-time which should be kept in mind before calling it? Thanks...</p>