Skip to content

Visualization of a sorting algorithm with sound

Notifications You must be signed in to change notification settings

Gouderg/sort-sound

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sort-Sound

Sorting Algorithm associated with sound and visual animations.

Algorithm

InsertionSort

Insertion sort iterates, consuming one input element each repetition, and grows a sorted output list. At each iteration, insertion sort removes one element from the input data, finds the location it belongs within the sorted list, and inserts it there. It repeats until no input elements remain.

Time complexity: $O(n^2)$

Space complexity: $O(1)$

BubbleSort

Bubble sort, sometimes referred to as sinking sort, is a simple sorting algorithm that repeatedly steps through the input list element by element, comparing the current element with the one after it, swapping their values if needed. These passes through the list are repeated until no swaps had to be performed during a pass, meaning that the list has become fully sorted. The algorithm, which is a comparison sort, is named for the way the larger elements "bubble" up to the top of the list.

Time complexity: $O(n^2)$

Space complexity: $O(n)$

SelectionSort

The algorithm divides the input list into two parts: a sorted sublist of items which is built up from left to right at the front (left) of the list and a sublist of the remaining unsorted items that occupy the rest of the list. Initially, the sorted sublist is empty and the unsorted sublist is the entire input list. The algorithm proceeds by finding the smallest (or largest, depending on sorting order) element in the unsorted sublist, exchanging (swapping) it with the leftmost unsorted element (putting it in sorted order), and moving the sublist boundaries one element to the right.

Time complexity: $O(n^2)$

Space complexity: $O(1)$

QuickSort

QuickSort is a Divide and Conquer algorithm. It picks an element as a pivot and partitions the given array around the picked pivot.

Time complexity: $O(nlog(n))$

Space complexity: $O(n)$

Link

https://stackoverflow.com/questions/582331/is-there-a-way-to-instantiate-objects-from-a-string-holding-their-class-name

https://stackoverflow.com/questions/865668/parsing-command-line-arguments-in-c

https://www.codeproject.com/Articles/257589/An-Idiots-Guide-to-Cplusplus-Templates-Part-1

https://www.youtube.com/watch?v=5xd9BMxoXqo

Library

  • C++17
  • SFML 2.5

About

Visualization of a sorting algorithm with sound

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published