From f45be890af5fe8b22d21b6f29c4faf9ea44d265a Mon Sep 17 00:00:00 2001 From: wdonahoe Date: Sat, 11 Jul 2015 10:45:08 -0400 Subject: [PATCH] fixed problems, new pull --- .../group_ordered/group_ordered.py | 34 ------------------- .../insertion_sort_challenge.ipynb | 0 2 files changed, 34 deletions(-) delete mode 100644 sorting_searching/group_ordered/group_ordered.py rename sorting_searching/{selection_sort => insertion_sort}/insertion_sort_challenge.ipynb (100%) diff --git a/sorting_searching/group_ordered/group_ordered.py b/sorting_searching/group_ordered/group_ordered.py deleted file mode 100644 index 7bb37fc..0000000 --- a/sorting_searching/group_ordered/group_ordered.py +++ /dev/null @@ -1,34 +0,0 @@ -def make_order_list(list_in): - order_list = [] - for item in list_in: - if item not in order_list: - order_list.append(item) - return order_list - - -def group_ordered(list_in): - if list_in is None: - return None - order_list = make_order_list(list_in) - current = 0 - for item in order_list: - search = current + 1 - while True: - try: - if list_in[search] != item: - search += 1 - else: - current += 1 - list_in[current], list_in[search] = list_in[search], list_in[current] - search += 1 - except IndexError: - break - return list_in - - -def group_ordered2(list_in): - from collections import OrderedDict - result = OrderedDict() - for value in list_in: - result.setdefault(value, []).append(value) - return result diff --git a/sorting_searching/selection_sort/insertion_sort_challenge.ipynb b/sorting_searching/insertion_sort/insertion_sort_challenge.ipynb similarity index 100% rename from sorting_searching/selection_sort/insertion_sort_challenge.ipynb rename to sorting_searching/insertion_sort/insertion_sort_challenge.ipynb