Skip to content

Commit 74ba427

Browse files
author
Anusha-DeviE
committed
Improve documentation for linear search algorithm
1 parent ca5b8c1 commit 74ba427

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

searches/linear_search.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
11
"""
2+
Linear Search Algorithm
3+
4+
Linear search is a simple searching technique that checks each element in the collection
5+
sequentially until the target element is found or the collection is exhausted.
6+
It is also known as sequential search.
7+
8+
Characteristics:
9+
- Works on both sorted and unsorted collections
10+
- Time complexity: O(n)
11+
- Space complexity: O(1)
12+
- Simple and reliable for small datasets
13+
14+
For large datasets or sorted collections, binary search or other logarithmic search
15+
algorithms are usually more efficient.
16+
217
This is pure Python implementation of linear search algorithm
318
419
For doctests run following command:

0 commit comments

Comments
 (0)