CSC234 - Project 5
Bubbles!

Assigned March 29th 1 p.m.
Due April 6th 12 p.m.


Overview

In this project, you will implement two sorting algorithms and analyze their performance.

Sorting Algorithms

The two algorithms you will implement are Bubble Sort and Shaker Sort.

Bubble Sort

Bubble sort is so named because of the similarity to bubbles rising slowly through water. It works by repeatedly iterating through the list to be sorted, comparing each pair of adjacent items and swapping them if they are in the wrong order. The iteration through the list is repeated until no swaps are needed.

Implement Bubble Sort for an array of integers.

Shaker Sort

This algorithm is an attempt to improve on Bubble Sort. Each iteration through the list is reversed, such that the first pass is from left to right, the second from right to left, the third from left to right, etc, until all elements are sorted.

Implement Shaker Sort for an array of integers.

Analysis

For each of the above algorithms, analyze the best, worst and average case performance. Find one permuation of the integers from 1-10 where Bubble Sort outperforms Shaker Sort, and one permutation of the integers from 1-10 where Shaker Sort outperforms Bubble Sort.

What to turn in

  1. SortStuff.java

© Mark Goadrich 2009, Centenary College of Louisiana