From 2183f3f860af34e45058ef078045322062b51f42 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Sun, 17 Apr 2016 00:49:33 +0300 Subject: 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. --- insertion_sort.py | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 insertion_sort.py (limited to 'insertion_sort.py') diff --git a/insertion_sort.py b/insertion_sort.py deleted file mode 100644 index 9e0912d..0000000 --- a/insertion_sort.py +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright 2015 Egor Tensin -# This file is licensed under the terms of the MIT License. -# See LICENSE.txt for details. - -def insertion_sort(xs): - for i in range(1, len(xs)): - j = i - while j > 0 and xs[j - 1] > xs[j]: - xs[j], xs[j - 1] = xs[j - 1], xs[j] - j -= 1 - return xs - -if __name__ == '__main__': - import sys - print(insertion_sort(list(map(int, sys.argv[1:])))) -- cgit v1.3