1
- Algorithms: a module of useful algorithms for Python
2
- ====================================================
1
+ Algorithms
2
+ ==========
3
3
4
- This is an attempt to build a cohesive module of algorithms in Python.
4
+ This is an attempt to build a cohesive module of algorithms in Python.
5
5
6
6
The purpose of this repo is to be a learning tool for myself and others.
7
7
@@ -11,69 +11,69 @@ Algorithms implemented so far:
11
11
------------------------------
12
12
13
13
**Sorting: **
14
- - Bogo Sort
15
- - Bubble Sort
16
- - Cocktail Sort
17
- - Comb Sort
18
- - Heap Sort
19
- - Insertion Sort
20
- - Merge Sort
21
- - Quick Sort
22
- - Selection Sort
23
- - Shell Sort
14
+
15
+ - Bogo Sort
16
+ - Bubble Sort
17
+ - Cocktail Sort
18
+ - Comb Sort
19
+ - Heap Sort
20
+ - Insertion Sort
21
+ - Merge Sort
22
+ - Quick Sort
23
+ - Selection Sort
24
+ - Shell Sort
24
25
25
26
**Searching: **
26
- - Binary Search
27
- - Boyer-Moore-Horspool
28
- - Knuth-Morris-Pratt
29
- - Rabin-Karp
27
+
28
+ - Binary Search
29
+ - Boyer-Moore-Horspool
30
+ - Knuth-Morris-Pratt
31
+ - Rabin-Karp
30
32
31
33
**Shuffling: **
32
- - Knuth/Fisher-Yates Shuffle
33
34
34
- **Math: **
35
- - Extended GCD
35
+ - Knuth/Fisher-Yates Shuffle
36
36
37
- Installation:
38
- -------------
39
-
40
- To clone the repository in to your working directory:
37
+ **Math: **
41
38
42
- .. code ::
39
+ - Extended GCD
43
40
44
- $ git clone https://github.com/nryoung/algorithms.git
45
41
46
- Requirements are listed in :code: `requirements.txt `.
42
+ Installation:
43
+ -------------
47
44
48
- If you are using pip and virtualenv you can simply do:
45
+ To install, simply
49
46
50
- .. code ::
47
+ ::
51
48
52
- $ pip install -r requirements.txt
49
+ $ pip install algorithms
53
50
54
51
55
52
Usage:
56
53
------
57
54
58
- Once cloned you can simply do the following in your program:
55
+ Once installed you can simply do the following in your program:
59
56
60
- .. code :: python
57
+ ::
61
58
62
59
from algorithms.sorting import bubble_sort
63
60
64
61
my_list = bubble_sort.sort(my_list)
65
62
63
+
66
64
All prequisites for the algorithms are listed in the source code for each algorithm.
67
65
66
+
68
67
Tests:
69
68
------
70
69
71
70
Nose is used as the main test runner and all Unit Tests can be run by:
72
71
73
- .. code ::
72
+ ::
74
73
75
74
$ python algorithms/run_tests.py
76
75
76
+
77
77
Contributing:
78
78
-------------
79
79
@@ -82,12 +82,14 @@ If there is an algorithm or data structure that you do not see, but would like t
82
82
1. For each algorithm and data structure you implement please have corresponding unit tests to prove correctness.
83
83
2. Please make sure that your module follows similar style guidelines that are laid out in the other modules.
84
84
85
- I want to personally thank everybody that has contributed so far and your names will be added to :code: `AUTHORS.rst `.
85
+ I want to personally thank everybody that has contributed so far and your names will be added to `AUTHORS.rst `.
86
+
86
87
87
88
TODO:
88
89
-----
89
90
90
- See :code: `TODO.rst `.
91
+ See `TODO.rst `.
92
+
91
93
92
94
License:
93
95
--------
0 commit comments