aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/merge_sort.py
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2016-04-17 00:49:33 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2016-04-17 00:49:33 +0300
commit2183f3f860af34e45058ef078045322062b51f42 (patch)
tree1f61c51be301db314720fe4a945d6ddaaffa8249 /merge_sort.py
parentREADME update (diff)
downloadsorting-algorithms-2183f3f860af34e45058ef078045322062b51f42.tar.gz
sorting-algorithms-2183f3f860af34e45058ef078045322062b51f42.zip
rearrange source files
* Add a useful `algorithms` package to provide convinient access to the implemented algorithms. * This allows to e.g. dynamically list available algorithms, which greatly simplifies a lot of things.
Diffstat (limited to '')
-rw-r--r--algorithms/impl/merge_sort.py (renamed from merge_sort.py)5
1 files changed, 5 insertions, 0 deletions
diff --git a/merge_sort.py b/algorithms/impl/merge_sort.py
index 6d5403d..9fa96ec 100644
--- a/merge_sort.py
+++ b/algorithms/impl/merge_sort.py
@@ -27,3 +27,8 @@ def merge_sort(xs):
if __name__ == '__main__':
import sys
print(merge_sort(list(map(int, sys.argv[1:]))))
+else:
+ from algorithms.algorithm import SortingAlgorithm
+ _ALGORITHMS = [
+ SortingAlgorithm('merge_sort', 'Merge sort', merge_sort),
+ ]