From 5224102d4ad414a12b03c6bcb3c7a98818a89fb2 Mon Sep 17 00:00:00 2001 From: danghai Date: Tue, 29 May 2018 14:55:05 -0700 Subject: [PATCH] reorganize sort --- algorithms/sort/__init__.py | 8 ++++++++ {sort => algorithms/sort}/bubble_sort.py | 0 {sort => algorithms/sort}/comb_sort.py | 0 {sort => algorithms/sort}/counting_sort.py | 0 {sort => algorithms/sort}/heap_sort.py | 0 {sort => algorithms/sort}/insertion_sort.py | 0 {sort => algorithms/sort}/meeting_rooms.py | 0 {sort => algorithms/sort}/merge_sort.py | 0 {sort => algorithms/sort}/quick_sort.py | 0 {sort => algorithms/sort}/selection_sort.py | 0 {sort => algorithms/sort}/sort_colors.py | 0 {sort => algorithms/sort}/topsort.py | 0 {sort => algorithms/sort}/wiggle_sort.py | 0 sort/__init__.py | 0 tests/test_sort.py | 18 ++++++++++-------- 15 files changed, 18 insertions(+), 8 deletions(-) create mode 100644 algorithms/sort/__init__.py rename {sort => algorithms/sort}/bubble_sort.py (100%) rename {sort => algorithms/sort}/comb_sort.py (100%) rename {sort => algorithms/sort}/counting_sort.py (100%) rename {sort => algorithms/sort}/heap_sort.py (100%) rename {sort => algorithms/sort}/insertion_sort.py (100%) rename {sort => algorithms/sort}/meeting_rooms.py (100%) rename {sort => algorithms/sort}/merge_sort.py (100%) rename {sort => algorithms/sort}/quick_sort.py (100%) rename {sort => algorithms/sort}/selection_sort.py (100%) rename {sort => algorithms/sort}/sort_colors.py (100%) rename {sort => algorithms/sort}/topsort.py (100%) rename {sort => algorithms/sort}/wiggle_sort.py (100%) delete mode 100644 sort/__init__.py diff --git a/algorithms/sort/__init__.py b/algorithms/sort/__init__.py new file mode 100644 index 000000000..20a3cf326 --- /dev/null +++ b/algorithms/sort/__init__.py @@ -0,0 +1,8 @@ +from .bubble_sort import * +from .comb_sort import * +from .counting_sort import * +from .heap_sort import * +from .insertion_sort import * +from .merge_sort import * +from .quick_sort import * +from .selection_sort import * diff --git a/sort/bubble_sort.py b/algorithms/sort/bubble_sort.py similarity index 100% rename from sort/bubble_sort.py rename to algorithms/sort/bubble_sort.py diff --git a/sort/comb_sort.py b/algorithms/sort/comb_sort.py similarity index 100% rename from sort/comb_sort.py rename to algorithms/sort/comb_sort.py diff --git a/sort/counting_sort.py b/algorithms/sort/counting_sort.py similarity index 100% rename from sort/counting_sort.py rename to algorithms/sort/counting_sort.py diff --git a/sort/heap_sort.py b/algorithms/sort/heap_sort.py similarity index 100% rename from sort/heap_sort.py rename to algorithms/sort/heap_sort.py diff --git a/sort/insertion_sort.py b/algorithms/sort/insertion_sort.py similarity index 100% rename from sort/insertion_sort.py rename to algorithms/sort/insertion_sort.py diff --git a/sort/meeting_rooms.py b/algorithms/sort/meeting_rooms.py similarity index 100% rename from sort/meeting_rooms.py rename to algorithms/sort/meeting_rooms.py diff --git a/sort/merge_sort.py b/algorithms/sort/merge_sort.py similarity index 100% rename from sort/merge_sort.py rename to algorithms/sort/merge_sort.py diff --git a/sort/quick_sort.py b/algorithms/sort/quick_sort.py similarity index 100% rename from sort/quick_sort.py rename to algorithms/sort/quick_sort.py diff --git a/sort/selection_sort.py b/algorithms/sort/selection_sort.py similarity index 100% rename from sort/selection_sort.py rename to algorithms/sort/selection_sort.py diff --git a/sort/sort_colors.py b/algorithms/sort/sort_colors.py similarity index 100% rename from sort/sort_colors.py rename to algorithms/sort/sort_colors.py diff --git a/sort/topsort.py b/algorithms/sort/topsort.py similarity index 100% rename from sort/topsort.py rename to algorithms/sort/topsort.py diff --git a/sort/wiggle_sort.py b/algorithms/sort/wiggle_sort.py similarity index 100% rename from sort/wiggle_sort.py rename to algorithms/sort/wiggle_sort.py diff --git a/sort/__init__.py b/sort/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/test_sort.py b/tests/test_sort.py index 30f27621c..07d13c8f3 100644 --- a/tests/test_sort.py +++ b/tests/test_sort.py @@ -1,11 +1,13 @@ -from sort.bubble_sort import bubble_sort -from sort.comb_sort import comb_sort -from sort.counting_sort import counting_sort -from sort.heap_sort import max_heap_sort, min_heap_sort -from sort.insertion_sort import insertion_sort -from sort.merge_sort import merge_sort -from sort.quick_sort import quick_sort -from sort.selection_sort import selection_sort +from algorithms.sort import ( + bubble_sort, + comb_sort, + counting_sort, + max_heap_sort, min_heap_sort, + insertion_sort, + merge_sort, + quick_sort, + selection_sort +) import unittest