When analyzing sorting algorithms, why is Merge Sort ($O(n ext{ log } n)$) considered efficient while Bubble Sort ($O(n^2)$) is considered inefficient, even if both are in P?

Answer

Merge Sort matches the known lower bound for comparison-based sorting, while Bubble Sort exceeds it

Efficiency in this context relates to matching the theoretical minimum requirement for the problem; Merge Sort meets the $O(n ext{ log } n)$ lower bound for comparison sorts, whereas Bubble Sort's $O(n^2)$ complexity is slower than that bound.

When analyzing sorting algorithms, why is Merge Sort ($O(n 	ext{ log } n)$) considered efficient while Bubble Sort ($O(n^2)$) is considered inefficient, even if both are in P?

#Videos

Algorithms Explained: Computational Complexity

complexityalgorithmcomputation