|
| 1 | +# Sorting algorithm visualizer |
| 2 | + |
| 3 | +Visualizing sorting algorithms, using the matplotlib library. |
| 4 | + |
| 5 | +Algorithms covered so far: |
| 6 | + |
| 7 | +| Name | Function Name | |
| 8 | +| - |:-: | |
| 9 | +| Quick Sort | quick_sort | |
| 10 | +| Bubble Sort | bubble_sort | |
| 11 | +| Selection Sort | selection_sort | |
| 12 | +| Insertion Sort | insertion_sort | |
| 13 | +| Heap Sort | heap_sort | |
| 14 | +| Merge Sort | merge_sort | |
| 15 | +| Cocktail Sort | cocktail_sort | |
| 16 | +| Cycle Sort | cycle_sort | |
| 17 | +| Pigeonhole Sort | pigeonhole_sort | |
| 18 | +| Comb Sort | comb_sort | |
| 19 | + |
| 20 | + |
| 21 | +# Usage: |
| 22 | + |
| 23 | +Install |
| 24 | + |
| 25 | +```pip install -r requirements.txt``` |
| 26 | + |
| 27 | +Run |
| 28 | + |
| 29 | +```python main.py function_name``` |
| 30 | + |
| 31 | +Pass function name as a command line argument from list of functions above |
| 32 | +(in all lower case and spaces replaced by underscore). |
| 33 | + |
| 34 | +**For example:** |
| 35 | + |
| 36 | +```python main.py quick_sort``` |
| 37 | + |
| 38 | +# How to contribute |
| 39 | + |
| 40 | +**If you want to add a new sorting algorithm:** |
| 41 | + |
| 42 | +1. Code the algorithm in ```sorting.py```. |
| 43 | +2. Name the function appropriately, like ```quick_sort```, ```bubble_sort```. |
| 44 | +3. While coding the function, **do not use python lists**. Instead, use an ```Array``` object. The ```Array``` class is defined in ```sorting.py```. (See already implemented algorithms, for your reference) |
| 45 | +4. The ```Array``` object has ```swap```, ```set```, ```get_len```, ```get``` methods implemented. Feel free to implement any more, additional methods, that you may see fit. |
| 46 | +5. Make sure you add the sorting algorithm to the Readme file! |
| 47 | +6. Make sure your newly implemented algorithm works, by running `test.py` after appending it to the list of algorithms in `test.py`. |
0 commit comments