mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-06 01:18:23 +08:00
Cocktail Shaker Sort | Improved Implementation
This commit is contained in:
@ -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')
|
||||||
|
Reference in New Issue
Block a user