Asymptotic notations are classified into three types:
Worst case time complexity: It is a function defined as a result of a maximum number of steps taken on any instance of size n. It is usually expressed in Big O notation.
Average case time complexity: It is a function defined as a result of the average number of steps taken on any instance of size n. It is usually expressed in Big theta notation.
Best case time complexity: It is a function defined as a result of the minimum number of steps taken on any instance of size n. It is usually expressed in Big omega notation.
Space complexity: It is a function defined as a result of additional memory space needed to carry out the algorithm. It is usually expressed in Big O notation.
- Big-Oh (O) notation
- Big Omega ( Ω ) notation
- Big Theta ( Θ ) notation
Default sort() in JavaScript uses insertion sort by V8 Engine of Chrome and Merge sort by Mozilla Firefox and Safari.
Heap Sort is regarded as an efficient algorithm, with average time complexity of θ(n log(n)).
Heap Sorting algorithm
the solution is to use Quick sort for large dataset.