- O(n) ---> If the size of the input n increases, the runtime will increase linearly.
- O(log n) ---> If the size of the input n increases, the runtime will increase logarithmically.
- O(1) ---> If the size of the input n increases, the runtime will remain constant (no change).
There are many other cases to consider, which we won't go into here. If interested please check out the following link: \http://bigocheatsheet.com.
We also extended Big Oh to determine the complexity of the worst case runtime of the sorting algorithms we considered the previous week. For instance, in the worst case bubble sort has a complexity of O(n**2), merge sort a complexity of O(n*log n), and insertion sort a complexity of O(n**2). Fortunately for me, I found this content to be a review of the material presented in CSC108.
No comments:
Post a Comment