Commit Graph

3 Commits

Author SHA1 Message Date
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
Shivam Singhal
2a0c019573 Your branch is up-to-date with 'origin/master'. 2017-05-27 18:10:04 +05:30
AnupKumarPanwar
1c1746bc64 Sorting 2017-02-20 09:08:44 +05:30