Big O notation is used to classify algorithms based on how the running time and space requirements grows as the input size grows. Big O notation is represented using upper case letter ‘O’ and the meaning of this notation is “Order of”.
Running Times in Big O notation
In Big O notation, we could say that linear search takes O(n) time, and binary search takes O(log n) time. To understand how to calculate logarithmic time please check Logarithmic time binary search.
And insertion of an element into an Unordered Array takes O(1) time i.e., constant time and deletion of an element from Unordered Array takes takes O(n) time. Similarly insertion of an element in to Ordered Array takes O(n) time and deletion of an element from Ordered Array takes O(n) time.
[table id=9 /]
- How to calculate binary Search time and space complexity
- Linear Search Time and Space Complexity
- Ordered Array Data Structure Example
- Unordered Array Data Structure Example