Skip to content

Commit fd8b492

Browse files
committed
Updated Searching.rst
1 parent 9ec9683 commit fd8b492

File tree

1 file changed

+37
-1
lines changed

1 file changed

+37
-1
lines changed

docs/Searching.rst

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,16 @@ 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,
34+
35+
.. code:: python
36+
37+
>>> from pygorithm.searching import modules
38+
>>> modules()
39+
['binary_search', 'breadth_first_search', 'depth_first_search', 'linear_search']
40+
3341
* For Searching:
34-
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.
3543

3644
.. code-block:: python
3745
@@ -64,3 +72,31 @@ Features
6472
6573
# for printing the source code of bubble_sort
6674
print(binary_search.get_code())
75+
76+
77+
Binary Search
78+
-------------
79+
80+
* Functions and their uses
81+
- search(List, key) : returns the position (index) of the key if key found, else returns -1. Note: `List` parameter **must** be sorted
82+
- time_complexities() : returns time complexities (Best, Average, Worst)
83+
- get_code() : returns the code for the ``binary_search.search()`` function
84+
85+
Linear Search
86+
-------------
87+
88+
* Functions and their uses
89+
- search(List, key) : returns the position (index) of the key if key found, else returns -1
90+
- time_complexities() : returns time complexities (Best, Average, Worst)
91+
- get_code() : returns the code for the ``linear_search.search()`` function
92+
93+
Breadth First Search
94+
--------------------
95+
96+
* Functions and their uses
97+
- .. py:function:: search(graph, startVertex)
98+
returns the bfs for the ``graph``
99+
- .. py:function:: time_complexities()
100+
returns time complexities
101+
- .. py:function:: get_code()
102+
returns the code for the ``breadth_first_search.search()`` function

0 commit comments

Comments
 (0)