Skip to content

Commit d40f463

Browse files
committed
Updated Docs
1 parent 4b88db8 commit d40f463

File tree

6 files changed

+177
-54
lines changed

6 files changed

+177
-54
lines changed

docs/Data_Structure.rst

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,27 @@ Features
5252
myStack = Stack()
5353
print(myStack.get_code())
5454
55-
* To see all the available functions in a module there is a `modules()` function available. For example,
55+
* To see all the available functions in a module, you can just type ``help()`` with the module name as argument. For example,
5656

5757
.. code:: python
5858
59-
>>> from pygorithm.data_structures import modules
60-
>>> modules()
61-
['graph', 'heap', 'linked_list', 'queue', 'stack', 'tree']
59+
>>> from pygorithm import data_structures
60+
>>> help(data_structures)
61+
Help on package pygorithm.data_structures in pygorithm:
62+
63+
NAME
64+
pygorithm.data_structures
65+
66+
PACKAGE CONTENTS
67+
graph
68+
heap
69+
linked_list
70+
modules
71+
queue
72+
stack
73+
tree
74+
>>> from pygorithm.data_structures import graph
75+
>>> help(graph)
6276
6377
Stack
6478
-----

docs/Fibonacci.rst

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,26 @@ Features
3232
code = fib_recursion.get_code()
3333
print(code)
3434
35-
* To see all the available functions in a module there is a `modules()` function available. For example,
35+
* To see all the available functions in a module, you can just type ``help()`` with the module name as argument. For example,
3636

3737
.. code:: python
3838
39-
>>> from pygorithm.fibonacci import modules
40-
>>> modules()
41-
['generator', 'goldenratio', 'memoization', 'recursion']
39+
>>> from pygorithm import fibonacci
40+
>>> help(fibonacci)
41+
Help on package pygorithm.fibonacci in pygorithm:
42+
43+
NAME
44+
pygorithm.fibonacci - Collection of fibonacci methods and functions
45+
46+
PACKAGE CONTENTS
47+
generator
48+
goldenratio
49+
memoization
50+
modules
51+
recursion
52+
53+
>>> from pygorithm.fibonacci import memoization
54+
>>> help(memoization)
4255
4356
Implementations API
4457
-------------------

docs/Math.rst

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
====
2+
Math
3+
====
4+
5+
Some of the mathematical algorithms and their implementations
6+
7+
Quick Start Guide
8+
-----------------
9+
10+
.. code-block:: python
11+
12+
# import the required math
13+
from pygorithm.math import lcm
14+
15+
# find the lcm for all the elements in the list
16+
ans = lcm.lcm([3, 12, 16])
17+
18+
#print the result
19+
print(ans)
20+
21+
Features
22+
--------
23+
24+
* Algorithms available:
25+
- LCM (lcm)
26+
- Sieve of Eratostenes (sieve_of_eratosthenes)
27+
28+
* To see all the available functions in a module there is a `modules()` function available. For example,
29+
30+
.. code:: python
31+
32+
>>> from pygorithm.math import modules
33+
>>> modules.modules()
34+
['lcm', 'sieve_of_eratosthenes']
35+
36+
* Get the code used for any of the algorithm
37+
38+
.. code-block:: python
39+
40+
from pygorithm.math import lcm
41+
42+
# for printing the source code of LCM function
43+
print(lcm.get_code())
44+
45+
46+
LCM
47+
---
48+
49+
* Functions and their uses
50+
51+
.. function:: lcm.lcm(List)
52+
53+
- **List** : `list` or `array` of which LCM is to be found
54+
- **Return Value** : returns the integer value of LCM
55+
56+
.. function:: lcm.get_code()
57+
58+
- **Return Value** : returns the code for the ``lcm.lcm()`` function
59+
60+
Sieve of Eratostenes
61+
--------------------
62+
63+
* Functions and their uses
64+
65+
.. function:: sieve_of_eratostenes.sieve_of_eratostenes(n)
66+
67+
- **n** : upper limit upto which prime numbers are to be found
68+
- **Return Value** : returns the `list` of all primes upto n
69+
70+
.. function:: sieve_of_eratostenes.get_code()
71+
72+
- **Return Value** : returns the code for the ``sieve_of_eratostenes.sieve_of_eratostenes()`` function

docs/Searching.rst

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,27 @@ Features
3030
- Breadth First Search (breadth_first_search)
3131
- Depth First Search (depth_first_search)
3232

33-
* To see all the available functions in a module there is a `modules()` function available. For example,
33+
* To see all the available functions in a module, you can just type ``help()`` with the module name as argument. For example,
3434

3535
.. code:: python
3636
37-
>>> from pygorithm.searching import modules
38-
>>> modules()
39-
['binary_search', 'breadth_first_search', 'depth_first_search', 'linear_search', 'quick_select']
37+
>>> from pygorithm import searching
38+
>>> help(searching)
39+
Help on package pygorithm.searching in pygorithm:
40+
41+
NAME
42+
pygorithm.searching - Collection of searching algorithms
43+
44+
PACKAGE CONTENTS
45+
binary_search
46+
breadth_first_search
47+
depth_first_search
48+
linear_search
49+
modules
50+
quick_select
51+
>>> from pygorithm.searching import binary_search)
52+
>>> help(binary_search)
53+
4054
4155
* For Searching:
4256
Remember ``search()`` function in `binary_search` module takes two parameters as a sorted list and the target element to be searched.

docs/Sorting.rst

Lines changed: 48 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -12,45 +12,51 @@ Quick Start Guide
1212
# import the required sort
1313
from pygorithm.sorting import bubble_sort
1414
15-
myList = [12, 4, 2, 14, 3, 7, 5]
15+
my_list = [12, 4, 2, 14, 3, 7, 5]
1616
17-
# to sort the list
18-
sorted_list = bubble_sort.sort(myList)
17+
# to sort the _list
18+
sorted__list = bubble_sort.sort(my_list)
1919
2020
Features
2121
--------
2222

23-
* Sorts available:
24-
- Bubble Sort (bubble_sort)
25-
- Selection Sort (selection_sort)
26-
- Insertion Sort (insertion_sort)
27-
- Merge Sort (merge_sort)
28-
- Quick Sort (quick_sort)
29-
- Bucket Sort (bucket_sort)
30-
- Counting Sort (counting_sort)
31-
- Heap Sort (heap_sort)
32-
- Shell Sort (shell_sort)
33-
34-
* To see all the available functions in a module there is a `modules()` function available. For example,
23+
* To see all the available functions in a module, you can just type ``help()`` with the module name as argument. For example,
3524

3625
.. code:: python
3726
38-
>>> from pygorithm.sorting import modules
39-
>>> modules.modules()
40-
['bubble_sort', 'bucket_sort', 'counting_sort', 'heap_sort', 'insertion_sort', 'merge_sort', 'quick_sort', 'selection_sort', 'shell_sort']
27+
>>> from pygorithm import sorting
28+
>>> help(sorting)
29+
Help on package pygorithm.sorting in pygorithm:
30+
31+
NAME
32+
pygorithm.sorting - Collection of sorting methods
33+
34+
PACKAGE CONTENTS
35+
bubble_sort
36+
bucket_sort
37+
counting_sort
38+
heap_sort
39+
insertion_sort
40+
merge_sort
41+
modules
42+
quick_sort
43+
selection_sort
44+
shell_sort
45+
>>> from pygorithm.sorting import bubble_sort
46+
>>> help(bubble_sort)
4147
4248
* For sorting:
43-
Remember ``sort()`` function takes its parameter as a list only.
49+
Remember ``sort()`` function takes its parameter as a _list only.
4450

4551
.. code-block:: python
4652
4753
# import the required sort
4854
from pygorithm.sorting import bubble_sort
4955
50-
myList = [12, 4, 2, 14, 3, 7, 5]
56+
my_list = [12, 4, 2, 14, 3, 7, 5]
5157
52-
# to sort the list
53-
sorted_list = bubble_sort.sort(myList)
58+
# to sort the _list
59+
sorted__list = bubble_sort.sort(my_list)
5460
5561
* Get time complexities of all the sorting algorithms
5662

@@ -76,9 +82,9 @@ Bubble Sort
7682

7783
* Functions and their uses
7884

79-
.. function:: bubble_sort.sort(List)
85+
.. function:: bubble_sort.sort(_list)
8086

81-
- **List** : `list` or `array` to be sorted
87+
- **_list** : `list` or `array` to be sorted
8288
- **Return Value** : returns the sorted `list`
8389

8490
.. function:: bubble_sort.time_complexities()
@@ -91,19 +97,19 @@ Bubble Sort
9197

9298
* For improved Bubble sort
9399

94-
.. function:: bubble_sort.improved_sort(List)
100+
.. function:: bubble_sort.improved_sort(_list)
95101

96-
- **List** : `list` or `array` to be sorted
102+
- **_list** : `list` or `array` to be sorted
97103
- **Return Value** : returns the sorted `list`
98104

99105
Bucket Sort
100106
-----------
101107

102108
* Functions and their uses
103109

104-
.. function:: bucket_sort.sort(List, bucketSize)
110+
.. function:: bucket_sort.sort(_list, bucketSize)
105111

106-
- **List** : `list` or `array` to be sorted
112+
- **_list** : `list` or `array` to be sorted
107113
- **bucketSize** : size of the bucket. Default is **5**
108114
- **Return Value** : returns the sorted `list`
109115

@@ -120,9 +126,9 @@ Counting Sort
120126

121127
* Functions and their uses
122128

123-
.. function:: counting_sort.sort(List)
129+
.. function:: counting_sort.sort(_list)
124130

125-
- **List** : `list` or `array` to be sorted
131+
- **_list** : `list` or `array` to be sorted
126132
- **Return Value** : returns the sorted `list`
127133

128134
.. function:: counting_sort.time_complexities()
@@ -138,9 +144,9 @@ Heap Sort
138144

139145
* Functions and their uses
140146

141-
.. function:: heap_sort.sort(List)
147+
.. function:: heap_sort.sort(_list)
142148

143-
- **List** : `list` or `array` to be sorted
149+
- **_list** : `list` or `array` to be sorted
144150
- **Return Value** : returns the sorted `list`
145151

146152
.. function:: heap_sort.time_complexities()
@@ -156,9 +162,9 @@ Insertion Sort
156162

157163
* Functions and their uses
158164

159-
.. function:: insertion_sort.sort(List)
165+
.. function:: insertion_sort.sort(_list)
160166

161-
- **List** : `list` or `array` to be sorted
167+
- **_list** : `list` or `array` to be sorted
162168
- **Return Value** : returns the sorted `list`
163169

164170
.. function:: insertion_sort.time_complexities()
@@ -174,9 +180,9 @@ Merge Sort
174180

175181
* Functions and their uses
176182

177-
.. function:: merge_sort.sort(List)
183+
.. function:: merge_sort.sort(_list)
178184

179-
- **List** : `list` or `array` to be sorted
185+
- **_list** : `list` or `array` to be sorted
180186
- **Return Value** : returns the sorted `list`
181187

182188
.. function:: merge_sort.time_complexities()
@@ -192,9 +198,9 @@ Quick Sort
192198

193199
* Functions and their uses
194200

195-
.. function:: quick_sort.sort(List)
201+
.. function:: quick_sort.sort(_list)
196202

197-
- **List** : `list` or `array` to be sorted
203+
- **_list** : `list` or `array` to be sorted
198204
- **Return Value** : returns the sorted `list`
199205

200206
.. function:: quick_sort.time_complexities()
@@ -210,9 +216,9 @@ Selection Sort
210216

211217
* Functions and their uses
212218

213-
.. function:: selection_sort.sort(List)
219+
.. function:: selection_sort.sort(_list)
214220

215-
- **List** : `list` or `array` to be sorted
221+
- **_list** : `list` or `array` to be sorted
216222
- **Return Value** : returns the sorted `list`
217223

218224
.. function:: selection_sort.time_complexities()
@@ -228,9 +234,9 @@ Shell Sort
228234

229235
* Functions and their uses
230236

231-
.. function:: shell_sort.sort(List)
237+
.. function:: shell_sort.sort(_list)
232238

233-
- **List** : `list` or `array` to be sorted
239+
- **_list** : `list` or `array` to be sorted
234240
- **Return Value** : returns the sorted `list`
235241

236242
.. function:: shell_sort.time_complexities()

docs/index.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
Pygorithm
33
=========
44

5+
Introduction
6+
------------
7+
58
``Pygorithm``: A fun way to learn algorithms on the go! Just import the module and start learning, it's that easy.
69

710
A Python module written in pure python and for purely educational purposes.
@@ -23,6 +26,7 @@ Quick Links
2326
Searching
2427
Data_Structure
2528
Fibonacci
29+
Math
2630

2731
Quick Start Guide
2832
-----------------

0 commit comments

Comments
 (0)