Preview

Shaker Sort Algorithm

Powerful Essays
Open Document
Open Document
1960 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Shaker Sort Algorithm
“Shaker Sort Algorithm”

History
Features
Algorithm/Process
Implementation
1. Pseudo code
2. Flowchart
3. Other programs Sample case study

History of shaker sort

Shaker Sort
(implemented by Jason Harrison)

Shaker Sort is like Selection Sort in that it passes over the unsorted part of the array to select the next element(s) to add to the sorted part. It differs in that with each pass it looks for the smallest and the largest remaining element. It then moves the smallest element into its position at the left end of the array and the largest element into position at the right end. Thus the sorted part of the array grows from each end.

Features
What is Shaker Sort?

Shaker sort, also known as bidirectional bubble sort, cocktail shaker sort, shaker sort (which can also refer to a variant of selection sort), ripple sort, shuffle sort,[1] shuttle sort or happy hour sort, is a variation of bubble sort that is both a stable sorting algorithm and a comparison sort. The algorithm differs from a bubble sort in that it sorts in both directions on each pass through the list. This sorting algorithm is only marginally more difficult to implement than a bubble sort, and solves the problem of turtles in bubble sorts. It provides only marginal performance improvements, and does not improve asymptotic performance; like the bubble sort, it is not of practical interest (insertion sort is preferred for simple sorts), though it finds some use in education.

Other names of shaker sort
People have given many different names to cocktail sort, but they all the same. The following names are used:
Shaker sort
Bi-directional sort
Cocktail shaker sort
Shuttle sort
Happy hour sort
Ripple sort

What is the difference between shaker sort and bubble sort?
The difference between cocktail sort and bubble sort is that instead of repeatedly passing through the list from bottom to top, it passes alternately from bottom to top and then from top to bottom. The result is that it has a slightly

You May Also Find These Documents Helpful