1 of 22

CSC 326 Group Project

Sorting Algorithms

Sameer Jain , Ahmed Hamza , Alex Putman

2 of 22

Bubble Sort

Time Complexity:

Best:O(n)

Avg : O(n^2)

Worst: O(n^2)

Space Complexity: O(1)

3 of 22

Insertion Sort

Time Complexity:

Best:O(n)

Avg : O(n^2)

Worst: O(n^2)

Space Complexity: O(1)

4 of 22

Selection Sort

Time Complexity:

Best:O(n^2)

Avg : O(n^2)

Worst: O(n^2)

Space Complexity: O(1)

5 of 22

Merge Sort

Time Complexity:

Best:O(nlog(n))

Avg : O(nlog(n))

Worst: O(nlog(n))

Space Complexity: O(n)

6 of 22

Merge Function

7 of 22

Merge Insertion Sort

Time Complexity:

O(nlog(n)) when greater than switch, O(n^2) for less than switch

Space Complexity: O(n)

(Same Merge Function)

8 of 22

Heap Sort

Time Complexity:

Best:O(nlog(n))

Avg : O(nlog(n))

Worst: O(nlog(n))

Space Complexity: O(1)

9 of 22

Max Heap

10 of 22

Quick Sort

Time Complexity:

Best:O(nlog(n))

Avg : O(nlog(n))

Worst: O(n^2)

Space Complexity

(Worst): O(1)

11 of 22

Hoarse vs Lamuto

12 of 22

Examples of Reverse Versions (Largest to Smallest)

13 of 22

Counting Steps

14 of 22

Process:

  1. Generate Random New Array of Size N

  • Copy it into global vector

  • Run Function for getting time

  • Re-Randomize Array using

Global vector

  • Repeat for finding steps, reverse algorithms and all 8

Data Set Sizes

15 of 22

Running the experiments

16 of 22

Function that takes in other functions as an Argument

17 of 22

Generating Random Arrays

18 of 22

19 of 22

Avg of time and steps

20 of 22

In whole project:

Total Functions:61

Lines of Code : ~2,000

Our Headers.cpp

21 of 22

Running the experiments

22 of 22

Replit and excel/word files

https://replit.com/join/fnzdhtbkqd-sameerjain501

Data:

(Task 1):

https://docs.google.com/spreadsheets/d/1vWTPmyX2VwndZPcjbfmm-3cxkEMoKYH00fI44v1fscg/edit?usp=sharing

(Task 2):

https://docs.google.com/spreadsheets/d/1BKbo1bFIx7Ax6Nh3gNtErdYFnpNI6KYakWHr2gB0T3Y/edit#gid=0

Extra Credit:

https://docs.google.com/document/d/17Lij8m9aCdy6pfZsVb2XFLZwU8hHg1_9sIcTJ4ZaOIY/edit