Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions searches/linear_search.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
"""
Linear Search Algorithm

Linear search is a simple searching technique that checks each element in the collection
sequentially until the target element is found or the collection is exhausted.
It is also known as sequential search.

Characteristics:
- Works on both sorted and unsorted collections
- Time complexity: O(n)
- Space complexity: O(1)
- Simple and reliable for small datasets

For large datasets or sorted collections, binary search or other logarithmic search
algorithms are usually more efficient.

This is pure Python implementation of linear search algorithm

For doctests run following command:
Expand Down