2. Linear Search Time Complexity #
Created Sunday 05 January 2020
For linear search we have 3 cases:
- Best case - constant. Key matches the first element.
- Average case - something in between.
- Worst case - Not present in the array or present at the last place. Time O(n).
- Worst case is what we are interested in - so O(n) is can be called “Time Complexity of the Linear search”.