Skip to content

Conversation

@Pixelrick420
Copy link

This pull request adds the Shaker Sort (also known as Cocktail Shaker Sort or Bidirectional Bubble Sort) algorithm to the repository.

Implemented the Shaker Sort algorithm in javascript-algorithms/src/sorting/shakersort.js
Included a brief description and time complexity analysis in the file’s docstring.

Shaker Sort is a variation of Bubble Sort that sorts bidirectionally : it passes through the list in both directions alternately.

Best Case: O(n) (already sorted)
Average Case: O(n²)
Worst Case: O(n²)

Space Complexity: O(1) (in-place)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant