- 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.
-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.
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
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
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.