@@ -4,7 +4,6 @@ Searching
44
55Learning searching algorithms easily!
66
7- -----------------
87Quick Start Guide
98-----------------
109
@@ -18,11 +17,10 @@ Quick Start Guide
1817 # pre-requisite for binary search is that the list should be sorted
1918 myList.sort()
2019
21- # to search en element in the above list
20+ # to search an element in the above list
2221 index = binary_search.search(myList, 7 )
2322 print (index)
2423
25- --------
2624 Features
2725--------
2826
@@ -32,8 +30,16 @@ Features
3230 - Breadth First Search (breadth_first_search)
3331 - Depth First Search (depth_first_search)
3432
33+ * To see all the available functions in a module there is a `modules() ` function available. For example,
34+
35+ .. code :: python
36+
37+ >> > from pygorithm.searching import modules
38+ >> > modules()
39+ [' binary_search' , ' breadth_first_search' , ' depth_first_search' , ' linear_search' , ' quick_select' ]
40+
3541 * For Searching:
36- Remember search() function takes two parameters as a sorted list and the target element to be searched.
42+ Remember `` search() `` function in ` binary_search ` module takes two parameters as a sorted list and the target element to be searched.
3743
3844.. code-block :: python
3945
@@ -45,7 +51,7 @@ Features
4551 # pre-requisite for binary search is that the list should be sorted
4652 myList.sort()
4753
48- # to search en element in the above list
54+ # to search an element in the above list
4955 index = binary_search.search(myList, 7 )
5056 print (index)
5157
@@ -66,3 +72,101 @@ Features
6672
6773 # for printing the source code of bubble_sort
6874 print (binary_search.get_code())
75+
76+
77+ Binary Search
78+ -------------
79+
80+ * Functions and their uses
81+
82+ .. function :: binary_search.search(List, key)
83+ :module: pygorithm.searching
84+
85+ - **List ** : *Sorted * list in which the key is to be searched
86+ - **key ** : key to be searched in the list
87+ - **Return Value ** : returns the position (index) of the key if key found, else returns -1
88+
89+ .. function :: binary_search.time_complexities()
90+
91+ - **Return Value ** : returns time complexities (Best, Average, Worst)
92+
93+ .. function :: binary_search.get_code()
94+
95+ - **Return Value ** : returns the code for the ``binary_search.search() `` function
96+
97+ Linear Search
98+ -------------
99+
100+ * Functions and their uses
101+
102+ .. function :: linear_search.search(List, key)
103+
104+ - **List ** : the list in which item is to searched
105+ - **key ** : key to be searched in the list
106+ - **Return Value ** : returns the position (index) of the key if key found, else returns -1
107+
108+ .. function :: linear_search.time_complexities()
109+
110+ - **Return value ** : returns time complexities (Best, Average, Worst)
111+
112+ .. function :: linear_search.get_code()
113+
114+ - **Return Value ** : returns the code for the ``linear_search.search() `` function
115+
116+ Breadth First Search
117+ --------------------
118+
119+ * Functions and their uses
120+
121+ .. function :: breadth_first_search.search(graph, startVertex)
122+
123+ - **graph ** : takes the graph data structures with edges and vertices
124+ - **startVertex ** : it tells the function the vertex to start with
125+ - **Return Value ** : returns the `set ` of bfs for the ``graph ``
126+
127+ .. function :: breadth_first_search.time_complexities()
128+
129+ - **Return Value ** : returns time complexities
130+
131+ .. function :: breadth_first_search.get_code()
132+
133+ - **Return Value ** : returns the code for the ``breadth_first_search.search() `` function
134+
135+ Depth First Search
136+ ------------------
137+
138+ * Functions and their uses
139+
140+ .. function :: breadth_first_search.search(graph, start, path)
141+
142+ - **graph ** : takes the graph data structures with edges and vertices
143+ - **start ** : it tells the function the vertex to start with
144+ - **path ** : returns the list containing the required dfs
145+ - **Return Value ** : returns the `list ` of dfs for the ``graph ``
146+
147+ .. function :: breadth_first_search.time_complexities()
148+
149+ - **Return Value ** : returns time complexities
150+
151+ .. function :: breadth_first_search.get_code()
152+
153+ - **Return Value ** : returns the code for the ``depth_first_search.search() `` function
154+
155+ Quick Select Search
156+ ------------------
157+
158+ * Functions and their uses
159+
160+ .. function :: quick_select.search(array, n)
161+
162+ - **array ** : an unsorted array
163+ - **n ** : nth number to be searched in the given `array `
164+ - **Return Value ** : returns the nth element
165+
166+ .. function :: quick_select.time_complexities()
167+
168+ - **Return Value ** : returns time complexities
169+
170+ .. function :: quick_select.get_code()
171+
172+ - **Return Value ** : returns the code for the ``quick_select.search() `` function
0 commit comments