TheAlgorithms-C-Plus-Plus/Sorting
Vaibhav Gupta f499342869
Optimize bubble sort algorithm
-introduced variable 'swap' for 'outer-for-loop' of bubble sort algorithm. If it remains zero after executing inner-loop, it means array is sorted, hence it does not need to run for n^2 times.
- 'for(int j=0; j<n-1-i; j++)', as after each step, one number reaches to its right position. Thus inner loop does not need to run for 'n' times in every cycle.
2018-10-02 16:34:16 +05:30
..
Bubble Sort.cpp Optimize bubble sort algorithm 2018-10-02 16:34:16 +05:30
bucketSort.cpp bucket sort code added 2017-09-29 07:55:30 +05:30
CocktailSelectionSort.cpp Added Cocktail Selection Sort 2017-12-30 02:10:22 +05:30
Heap Sort .cpp Sorting 2017-02-20 09:08:44 +05:30
Insertion Sort.cpp Sorting 2017-02-20 09:08:44 +05:30
Merge Sort.cpp Sorting 2017-02-20 09:08:44 +05:30
Quick Sort.cpp Sorting 2017-02-20 09:08:44 +05:30
Radix Sort.cpp Sorting 2017-02-20 09:08:44 +05:30
Selection Sort.cpp Sorting 2017-02-20 09:08:44 +05:30
Shell Sort.cpp Sorting 2017-02-20 09:08:44 +05:30
Slow Sort.cpp Added SlowSort 2017-12-25 23:38:23 +05:30
Tim Sort.cpp Tim Sort.cpp 2017-10-28 16:26:02 +05:30