Time and Space complexity Time Complexity Time complexity of an algorithm quantifies the amount of time taken by an algorithm to run as a function of the length of the input. Types of notations 1. O-notation: It is used to denote asymptotic upper bound. For a given function g(n), we denote it by O(g(n)). Pronounced as “big-oh of g of n”. It also known as worst case time complexity as it denotes the upper bound in which algorithm terminates. 2. Ω-notation: It is used to denote asymptotic lower bound. For a given function g(n), we denote it by Ω(g(n)). Pronounced as “big-omega of g of n”. It also known as best case time complexity as it denotes the lower bound in which algorithm terminates. 3. !-notation: It is used to denote the average time of a program. Comparison of functions on the basis of time complexity It follows the following order in case of time complexit...
Comments
Post a Comment