diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2016-04-18 18:28:39 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2016-04-18 18:28:39 +0300 |
commit | cb2614105039d77c01b8c0e2bf2464bb8a2c1f76 (patch) | |
tree | 86e2a7eabfa796de4a904525d11268a204e18b43 | |
parent | refactoring + better plot captions (diff) | |
download | sorting-algorithms-cb2614105039d77c01b8c0e2bf2464bb8a2c1f76.tar.gz sorting-algorithms-cb2614105039d77c01b8c0e2bf2464bb8a2c1f76.zip |
README update
Diffstat (limited to '')
-rw-r--r-- | README.md | 41 |
1 files changed, 32 insertions, 9 deletions
@@ -18,6 +18,8 @@ Currently the following algorithms are implemented: * selection sort (`selection_sort.py`), * calculating the median of a list (`median.py`). +### Testing + You can test each of the algorithms above by passing a sequence of integer numbers to the corresponding script: @@ -36,9 +38,18 @@ middle, the last or a random element of the sequence. [1, 2, 3, 4, 5] [1, 2, 3, 4, 5] +#### test.py + You can use the generic script `test.py` to quickly generate an input list of -some kind and display the result of executing an algorithm on this input. +some kind and display the result of executing an algorithm for this input. Consult the output of `test.py -h` to learn how to use the script. +A few usage examples are listed below. + + > test.py -l quicksort_random -i ascending -n 10 + [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + + > test.py --algorithm median_heaps --order random --length 100 + 49.5 ## Plots @@ -57,20 +68,27 @@ plots to the `plots/` directory. Both the hardware & the software that were used to produce the plots are listed below. - | | --------------- | ---------------------------------------------------------------------------------------------------------- | -**CPU** | [Intel Core i3-5005U](http://ark.intel.com/products/84695/Intel-Core-i3-5005U-Processor-3M-Cache-2_00-GHz) | -**OS** | Windows 8.1 | -**Python** | 3.5.1 | -**matplotlib** | 1.5.1 | +Component | Version | +---------- | -------------------------------------- | +CPU | Intel Core i3-5005U [[1]](#references) | +OS | Windows 8.1 | +Python | 3.5.1 | +matplotlib | 1.5.1 | Each of the implemented algorithms was provided with three input sequences: * a list of *n* consecutive numbers sorted in ascending order, * ... in descending order, * ... in random order. +### plot.py + You can generate the plots using `plot.py`. Consult the output of `plot.py -h` to learn how to use the script. +A few usage examples are listed below. + + > plot.py --algorithm merge_sort --min 0 --max 200 --order ascending -iterations 1000 + + > plot.py -l median_sort_first -a 0 -b 200 -i random -r 100 -o median_sort_first.png If you're having problems using the script (like having excessive noise in the measurement results), try minimizing background activity of the OS and the @@ -79,10 +97,15 @@ For example, on Windows 8.1 I managed to produce some very nice plots by booting into Safe Mode and running the scripts with a higher priority while also setting their CPU affinity: - start /affinity 1 /realtime plot.py ... + > start /affinity 1 /realtime plot.py ... ## Licensing This project, including all of the files and their contents, is licensed under the terms of the MIT License. -See [LICENSE.txt](LICENSE.txt) for details. +See LICENSE.txt [[2]](#references) for details. + +## References + +1. http://ark.intel.com/products/84695/Intel-Core-i3-5005U-Processor-3M-Cache-2_00-GHz +2. https://github.com/egor-tensin/sorting_algorithms/blob/master/LICENSE.txt |