Sorting-Algorithms icon indicating copy to clipboard operation
Sorting-Algorithms copied to clipboard

bubble sort is wrong

Open deguilardi opened this issue 5 years ago • 4 comments

bubble sort is wrong, the time complexity is always n^2

deguilardi avatar Oct 13 '19 20:10 deguilardi

Can you please link the file saying which code is wrong? Is it wrong in all languages? You can open a PR after making a fix.

diptangsu avatar Oct 20 '19 09:10 diptangsu

The bubble sort is wrong in every language. The time complexity of your code is always n^2, the best case should be n. There is an optimization missing.

deguilardi avatar Oct 22 '19 16:10 deguilardi

Fixed this issue in C (commit ID: 84445fe) and C++ (commit ID: c9bd2d6)

arathyrose avatar Oct 31 '19 10:10 arathyrose

I developed the code to be more clear. This is my commit : 44f3b5ab8be2dbac5ba57e921860b6cd8797d0cf

wassim31 avatar Jul 29 '21 23:07 wassim31