aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/algorithms/impl/insertion_sort.py
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2019-12-23 07:32:18 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2019-12-23 07:32:18 +0300
commit0d25b5d6957d76bab486e2279c99e130c19d5c31 (patch)
treec8c7d6fe4766470bda03e49a004afaa03c967b16 /algorithms/impl/insertion_sort.py
parentTravis: add badge to README (diff)
downloadsorting-algorithms-0d25b5d6957d76bab486e2279c99e130c19d5c31.tar.gz
sorting-algorithms-0d25b5d6957d76bab486e2279c99e130c19d5c31.zip
pylint/pep8 fixes
Diffstat (limited to 'algorithms/impl/insertion_sort.py')
-rw-r--r--algorithms/impl/insertion_sort.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/algorithms/impl/insertion_sort.py b/algorithms/impl/insertion_sort.py
index 1abbf84..13f16a0 100644
--- a/algorithms/impl/insertion_sort.py
+++ b/algorithms/impl/insertion_sort.py
@@ -7,6 +7,7 @@ import sys
from ..algorithm import SortingAlgorithm
+
def insertion_sort(xs):
for i in range(1, len(xs)):
j = i
@@ -15,18 +16,22 @@ def insertion_sort(xs):
j -= 1
return xs
+
_ALGORITHMS = [
SortingAlgorithm('insertion_sort', 'Insertion sort', insertion_sort),
]
+
def _parse_args(args=None):
if args is None:
args = sys.argv[1:]
return list(map(int, args))
+
def main(args=None):
xs = _parse_args(args)
print(insertion_sort(list(xs)))
+
if __name__ == '__main__':
main()