Project #5: Bubble
Write a program that performs a bubble sort

DESCRIPTION

Requirements

  • Write a program that performs a Bubble sort on the specified data

  • Your program should run on O(n^2) time with an early exit for sorted data

  • Your program must output each major step it takes in sorting the data

    • Clarification: Print once line for each execution of your outer loop

CHALLENGE (+10%)

Option #1 - Basic

  • Implement two extra O(n²) sorts

  • Examples: Selection Sort, Insertion Sort

Option #2 - Jokes

  • Implement two joke sorts

  • Examples: Bogo Sort, Stalin Sort

Option #3

  • Implement one O(n log n) sort

  • Examples: Merge Sort, Quick Sort

EXAMPLE: RUNNING PROGRAM

Choose a Sort (0) Quit (1) Bubble

> 1


5 3 2 1 9 82 7

3 2 1 5 9 7 82

2 1 3 5 7 9 82

1 2 3 5 7 9 82


Choose a Sort (0) Quit (1) Bubble

> 0


Goodbye.