VAR-solutions / Algorithms

A repository of different Algorithms and Data Structures implemented in many programming languages.
https://var-solutions.github.io/Algorithms/
MIT License
764 stars 1.01k forks source link

BubbleSort needs optimization for best-case scenario #1626

Open wassim31 opened 3 years ago

wassim31 commented 3 years ago

in bubblesort.c , the program needs improvement , for best case scenario where the array is sorted , we don't need to process each element again. So from O(n²) we gonna have O(n) time complexity. Also , it needs a lot of code design improvement.

Gaurav12477 commented 2 years ago

can I do this ?