RajasekharwhY / Build-your-muscle

Learning concepts and sample practice code - C#, MVC, SQL etc..
2 stars 0 forks source link

Big O notation #9

Closed RajasekharwhY closed 5 years ago

RajasekharwhY commented 5 years ago

O(1) ==> constant O(n) ==> Linear - also called "brute force" performance is dependent on the input size. For our example, we'll read through each item in the array and search for the number we need.
O(log n) ==> logarithmic ( Example -- finding an item in a sorted array with a binary search or a balanced search tree as well as all operations in a Binomial heap): Logarithmic O(log N) — narrows down the search by repeatedly halving the dataset until you find the target value. Using binary search — which is a form of logarithmic algorithm, finds the median in the array and compares it to the target value. The algorithm will traverse either upwards or downwards depending on the target value being higher than, lower than or equal to the median. graph showing big o notation

RajasekharwhY commented 5 years ago

Listed the basics of big O notation and difference between O(1) - constant, O(n) linear, O( log n) loger themic. If you want to go deeper need to create another issue.