# Big Oh Notation!. Noted.

Every time we solve a problem online, there is something always the platform demand us to meet that is Time Complexity. Time Complexity is none other than the growth of function which tells the amount of tests that that algorithm performs in order to complete a problem.

The complexity is denoted in three forms, best, average and worst case. In a linear search, When the element is found and program is terminated at the very first attempt then the best and desired case is 1 and denoted with an Omega. Whilst , the worst case tends to be O(n) in the same linear search as the element can be present at the very last index of the array.

In reference to the last article of Blog, where Binary Search took way less time than the linear search, the time complexity of Binary Search is way better than that of Linear search. The linear search will have to perform n test cases while the binary search will perform log(n) operations which decreases the execution time by a humungous contribution when the number of execution to be performed is extremely high.

Here are few of the examples:

O(log n), also known as log time. Example: Binary search.

O(n), also known as linear time. Example: Simple search.

O(n * log n), A fast sorting algorithm, like quicksort

O(n^2), A slow sorting algorithm, like selection sort

O(n!), A really slow algorithm, like the traveling

salesperson

The log in programming always has a base of 2 unlike the one with 10 in general mathematics. It is an integral topic that is very crucial for the coding interviews and people go for mugging them up which turns out to be a blunder and end up facing the consequences.

--

--

Freelance Writer, SEO Expert, Computer Science Enthusiast, Trade Analyst and sometimes a Nutritionist too.