Quick Sort

Project #1

Create an interactive program to demonstrate a quick sort.

Design

  1. The program will sort positive integers
  2. The program will start with 10 randomized numbers
  3. The program will loop until the user enters the "quit" command
  4. The program will display information explaining the commands
  5. The program will accept commands (strings) from the user
  6. Commands are case insensitive
  7. The first non-blank characters entered will be the command
    (except for the # command)
  8. Blank commands (empty strings) are ignored
  9. Illegal commands will generate an error message
  10. The commands are
    • D - display the numbers
    • S - sort the numbers
    • R - randomize the numbers
    • G - generate a new set of randomized numbers
    • Q - quit the program
    • # - change the number of numbers to sort (0 to 20)
            (a new set of randomized numbers will be generated)

Project #2

Collect and display performance statistics.

Generate arrays of random integers (size: 10, 40, 60, 100, 200) for testing. Display a table of collected statistics.

import time start = time.perf_counter() <SORT> end = time.perf_counter() print(f'Completed in {end-start:.2f} seconds')

Project #3

The same as Project #2 except collect and display statistics for Bubble Sort, Quick Sort, and Insertion Sort. (To make the comparison useful, use the same integer arrays for the sorts.)

Quick Sort Algorithm

Quick Sort (Wikipedia )
QuickSort – Data Structure and Algorithm Tutorials
Sorting algorithms/Quicksort
Sorting Algorithms

Try This

Use positive and negative integers.
Use floating point numbers.
Sort (case insensitive) strings rather than numbers.