Commit Graph

8 Commits

Author SHA1 Message Date
Vaibhav Gupta
485d1b2bb8
solve bus-error (core dumped), run-time error
- Run time error on linux.
  - 'n' is declared but not initialized, neither its value is taken from user.
  - 'n' contains garbage value, thus throws run time error.
2018-10-02 17:05:25 +05:30
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
Naveen Hegde
d4c358f369
Added Cocktail Selection Sort
Cocktail Selection Sort is a Sorting algorithm which chooses the minimum and maximum element in an array simultaneously, and swaps it with the lowest and highest available position iteratively or recursively
2017-12-30 02:10:22 +05:30
Naveen Hegde
e1879d3432
Added SlowSort
added the main function as requested.
added only the necessary header as requested.
Description of Slow Sort can be found here https://en.wikipedia.org/wiki/Slowsort
2017-12-25 23:38:23 +05:30
sandeeproy99
8b6530526a
Tim Sort.cpp
Tim Sort Algorithm is based on radix sort & bubble sort.

It's stable algorithm which works in O(n Log n) time, is used in Java's Array.sort(). It first sorts using small pieces, later sorts each with merge sort.
2017-10-28 16:26:02 +05:30
Sayantika Banik
4d8185f83e bucket sort code added 2017-09-29 07:55:30 +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