A program (sorting) that sorts an array using Bubble Sort, Shell Sort, and 2 versions of Quicksort (using a stack and using a queue). Programs were created and tested on Ubuntu 20.04.
Execute the command make
and it should compile using the provided makefile.
Run the compiled binary with ./sorting
- -a : Enables all sorting algorithms
- -b : Enables Bubble Sort
- -s : Enables Shell Sort
- -q : Enables Quicksort that utilizes a stack
- -Q : Enables Quicksort that utilizes a queue
- -r
seed
: Set the random seed toseed
(Default is 13371453) - -n
size
: Set the array size tosize
(Default is 100) - -p
elements
: Print outelements
number of elements from the array (Default is 100)
This makefile compiles the program.
- remove binaries using
make clean
- run a memory leak test using
make leak-check
- format code using
make format
Python pseudocode for the sorting algorithms
This is the program that is compiled and executed
Set datatype implementation
Header file for set datatype
Global variable definitions for moves
, comparisons
, and datastruct_size
Bubble sort implementation (bubble_sort
)
Header file defining bubble_sort
Shell sort implementation (shell_sort
)
Header file defining shell_sort
Header file defining an array containing the amount of Gaps in the Pratt sequence implementation
Quicksort implementations:
quick_sort_stack
for algorithm using a stackquick_sort_queue
for implementation using a queue
Stack datatype implementation
Header file defining stack methods
Queue datatype implementation
Header file defining queue methods
This document details how the program was designed. This includes:
- The objective of the assignment
- What was given in the lab doc
- Prelab questions
- Pseudocode for the test harness
- General explanation for code implementation
Analysis of sorting algorithm efficiency
HIDDEN FOLDERS
.DESIGN contains the LaTeX document for the design document
.WRITEUP contains the LaTeX document for the writeup as well as the graph jpgs and bash scripts used to produce them
- Quick sort time complexity:
- Shell sort gaps:
- Shell sorting visualization:
- Reverse order visualizations:
- Dynamic memory allocation:
- extern: