Sorting Algorithms
A collection of sorting algorithms in Python 3, Golang, TypeScript, and C++. Algorithms range from bogo sort to bubble sort to merge sort. I also use tkinter to animate the algorithms with bar graphs.
How to run
Python
Animated
Install dependencies
pip install -r requirements.txt
Run Program
python3 . animated
Normal
python3 . <sortNames>
E.g
python3 . bogoSort bubbleSort
Node JS
Install dependencies
With Yarn:
yarn --frozen-lockfile
With NPM:
npm ci
Build
With Yarn:
yarn build
With NPM:
npm run build
Run Program
For all options, run
node . --help
Options:
-bogo, --bogoSort Run bogo sort algorithm
-bubble, --bubbleSort Run bubble sort algorithm
-cocktail, --cocktailShakerSort Run cocktail shaker sort algorithm
-comb, --combSort Run comb sort algorithm
-counting, --countingSort Run counting sort algorithm
-gnome, --gnomeSort Run gnome sort algorithm
-insertion, --insertionSort Run insertion sort algorithm
-merge, --mergeSort Run merge sort algorithm
-mergeIP, --mergeSortInPlace Run in-place merge sort algorithm
-quick, --quickSort Run quickSort sort algorithm
-lsd, --radixLSD Run radix sort least significant digit algorithm
-msd, --radixMSD Run raidx sort most significant digit algorithm
-shell, --shellSort Run raidx sort algorithm
-tim, --timSort Run tim sort algorithm
-h, --help display help for command
Example:
node . -bogo --bubbleSort
Go
Run directly
go run main.go <sortnames>
go run main.go bogo bubbleSort
Compile first
Build/compile
go build main.go
Run/execute
./main <sortnames>
E.g
go build main.go
./main bogo bubbleSort
C++
Build/compile
make
Run/execute
./bin <sortnames>
./bin bogo bubbleSort
E.g
make
./bin bogo bubbleSort