Solution of the task for Amazon. [Avi EMEA]
Visualizing sorting algorithms, using the matplotlib library.
Algorithms covered so far:
Name | Function Name |
---|---|
Quick Sort | quick_sort |
Bubble Sort | bubble_sort |
Selection Sort | selection_sort |
Insertion Sort | insertion_sort |
Heap Sort | heap_sort |
Merge Sort | merge_sort |
Cocktail Sort | cocktail_sort |
Cycle Sort | cycle_sort |
Pigeonhole Sort | pigeonhole_sort |
Comb Sort | comb_sort |
Install
pip install -r requirements.txt
Run
python main.py function_name
Pass function name as a command line argument from list of functions above
(in all lower case and spaces replaced by underscore).
For example:
python main.py quick_sort
If you want to add a new sorting algorithm:
sorting.py
.quick_sort
, bubble_sort
.Array
object. The Array
class is defined in sorting.py
. (See already implemented algorithms, for your reference)Array
object has swap
, set
, get_len
, get
methods implemented. Feel free to implement any more, additional methods, that you may see fit.test.py
after appending it to the list of algorithms in test.py
.