diff options
| author | Egor Tensin <Egor.Tensin@gmail.com> | 2016-04-17 00:49:33 +0300 |
|---|---|---|
| committer | Egor Tensin <Egor.Tensin@gmail.com> | 2016-04-17 00:49:33 +0300 |
| commit | 2183f3f860af34e45058ef078045322062b51f42 (patch) | |
| tree | 1f61c51be301db314720fe4a945d6ddaaffa8249 /selection_sort.py | |
| parent | README update (diff) | |
| download | sorting-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 'selection_sort.py')
| -rw-r--r-- | selection_sort.py | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/selection_sort.py b/selection_sort.py deleted file mode 100644 index c466bea..0000000 --- a/selection_sort.py +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright 2015 Egor Tensin <Egor.Tensin@gmail.com> -# This file is licensed under the terms of the MIT License. -# See LICENSE.txt for details. - -def selection_sort(xs): - for i in range(len(xs) - 1): - min_i = i - for j in range(i + 1, len(xs)): - if xs[j] < xs[min_i]: - min_i = j - if min_i != i: - xs[i], xs[min_i] = xs[min_i], xs[i] - return xs - -if __name__ == '__main__': - import sys - print(selection_sort(list(map(int, sys.argv[1:])))) |
