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

  • Good Essays

    Nt1420 Unit 6

    • 1145 Words
    • 5 Pages

    INSTRUCTIONS: 1. THERE ARE SIX (6) QUESTIONS IN THIS PAPER. 2. ANSWER FIVE (5) QUESTIONS ONLY. Question 1 Arrays are used when storing a large number of values. You are required to create an array named a and answer the following questions regarding array manipulation. a. Write a method fillRandom(int[] a, int min, int max), fill the array a with a random integer value. (Note: Math.random() returns a double in the range of 0.0 and 1.0, therefore it is cast to an integer number, between the minimum and maximum value). [6 marks] b. Write the Bubble sort method to sort array a into descending order. [10 marks] c. In the quicksort, an algorithm an element is chosen from the unsorted list. This element is called the…

    • 1145 Words
    • 5 Pages
    Good Essays
  • Satisfactory Essays

    Pt1420 Unit 4

    • 380 Words
    • 2 Pages

    The _____Navigation____ pane treats a heading and the body text that follows as a single unit.…

    • 380 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    ECET 370 Week 5 Lab 5

    • 650 Words
    • 3 Pages

    Exercise 1: Review of the Lecture Content Create a project using the ArrayList class and the Main class provided in DocSharing. The ArrayList class contains implementations of the first three search methods explained in this week's lecture: sequential, sorted, and binary search. The Main class uses these three methods. These programs test the code discussed in the lecture. Compile the project, run it, and review the code that is given carefully.…

    • 650 Words
    • 3 Pages
    Good Essays
  • Satisfactory Essays

    4) Make another copy of the data values listed in column 1 and paste those into column 3. Then sort only…

    • 622 Words
    • 3 Pages
    Satisfactory Essays
  • Good Essays

    When sorting by number, there will be a significant time difference. The low vision cards will cause confusion since they lack the corresponding number of symbols to the card number.…

    • 1300 Words
    • 6 Pages
    Good Essays
  • Good Essays

    Tsunderstood Tumbler

    • 564 Words
    • 3 Pages

    A sequence begins much like any singular tumbling action. However it takes more force and power to carry through with a sequence of tumbling. Usually tumblers get a running start building up the momentum that will help them later. Next the tumbler will usually do a round off to begin and afterward a back-hand spring. Momentum will carry the tumbler through the sequences and the continued application of Newton's Laws with equal and opposite force against the ground will keep propelling the tumbler forward. The end of this sequence, a full, is a little different than what has been discussed previously. A full is literally spinning in the air, and torque is the main force behind the spin. The angular momentum converts into torque and allows the tumblers body to spin as if spinning on an axis until they land again.…

    • 564 Words
    • 3 Pages
    Good Essays
  • Satisfactory Essays

    Rhetorical Modes Matrix

    • 462 Words
    • 2 Pages

    Spatial order is a method of organization that arranges ideas according to physical characteristics or appearance.…

    • 462 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    Rhetorical Modes Matrix

    • 649 Words
    • 3 Pages

    Spatial order is the best method. This method arranges ideas, according to physical characteristics or appearances.…

    • 649 Words
    • 3 Pages
    Good Essays
  • Good Essays

    Info1105

    • 951 Words
    • 4 Pages

    Now if we traverse the list from head to tail, we always get a sorted list.…

    • 951 Words
    • 4 Pages
    Good Essays
  • Good Essays

    Arranged from left to right in rows (periods) by increasing atomic number and top to bottom in columns (groups) based on similar chemical properties.…

    • 2160 Words
    • 7 Pages
    Good Essays
  • Good Essays

    3) A description of at least two methods of sorting records and the benefits of each:…

    • 1173 Words
    • 6 Pages
    Good Essays
  • Better Essays

    Stable Order Rule means numbers are assigned in the correct order every time a group of items are counted.…

    • 1817 Words
    • 8 Pages
    Better Essays
  • Good Essays

    Java

    • 490 Words
    • 3 Pages

    Write a Java program to demonstrate using bitmaps and bitwise operators to sort and remove duplicates from a file of random phone numbers. Do not confuse the term bitmap used for compressing data into smaller spaces with the bitmap that has come to mean a graphic image.…

    • 490 Words
    • 3 Pages
    Good Essays
  • Satisfactory Essays

    9. Observations made in natural habitat, helped to show that the societies and behavior of animals are far more complex than previously supposed…

    • 284 Words
    • 2 Pages
    Satisfactory Essays
  • Powerful Essays

    sort. It was used widely in the past and still exists in some areas today. It…

    • 1412 Words
    • 6 Pages
    Powerful Essays