Cocktail Shaker Sort | Improved Implementation

This commit is contained in:
marsonya
2020-11-02 15:26:21 +05:30
parent ac488fe626
commit aab8a555fc

View File

@ -35,9 +35,11 @@ function cocktailShakerSort (items) {
/** /**
* Implementation of Cocktail Shaker Sort * Implementation of Cocktail Shaker Sort
*/ */
var ar = [5, 6, 7, 8, 1, 2, 12, 14] var array = [5, 6, 7, 8, 1, 2, 12, 14]
// Before Sort // Before Sort
console.log(ar) console.log('\n- Before Sort | Implementation of Cocktail Shaker Sort -')
cocktailShakerSort(ar) console.log(array)
// After Sort // After Sort
console.log(ar) console.log('- After Sort | Implementation of Cocktail Shaker Sort -')
console.log(cocktailShakerSort(array))
console.log('\n')