+ 3
😭Why the time taken by BUBBLE SORT is so much higher than other sorting algorithms?😭😢
2 ответов
+ 2
Bubble sort has the worst time complexity of all sorting algorithms, O(n²)
You are comparing each element with every other, and you typically swap one element multiple times. https://en.m.wikipedia.org/wiki/Bubble_sort
+ 2
Bubble sort is a simple and easy to understand algorithm which comes at a cost of bad time complexity of (O(n²)), making it suitable for beginners who don't know concepts like stacks, queues, recursion etc. used to implement more complex algorithms.