😭Why the time taken by BUBBLE SORT is so much higher than other sorting algorithms?😭😢 | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 3

😭Why the time taken by BUBBLE SORT is so much higher than other sorting algorithms?😭😢

https://code.sololearn.com/cnD4gpY0d32o/?ref=app

9th May 2020, 5:38 AM
Abhay Kalsi
Abhay Kalsi - avatar
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
9th May 2020, 5:50 AM
Tibor Santa
Tibor Santa - avatar
+ 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.
9th May 2020, 6:30 AM
Arsenic
Arsenic - avatar