# Running time in Big O notation for Java Arrays Algorithms

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 our previous posts (Please check Linear Search Complexity, Binary Search Complexity) we have explained how to calculate running time in Big O notation.

In Big O notation, we could say that linear search takes * O(n) *time, and binary search takes

*time. To understand how to calculate logarithmic time please check Logarithmic time binary search.*

**O(log n)**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.

Arrays Algorithm | Big O Notation/ Running Time |
---|---|

Linear Search Algorithm | O(n) |

Binary Search Algorithm | O(log n) |

Insertion of an element in to Unordered Array | O(1) |

Deletion of an element from Unordered Array | O(n) |

Insertion of an element in to Ordered Array | O(n) |

Deletion of an element from Ordered Array | O(n) |

##### Recommended Posts

- 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

## Leave a Reply