Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion searches/double_linear_search_recursion.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
def search(list_data: list, key: int, left: int = 0, right: int = 0) -> int:
def search(list_data: list[int], key: int, left: int = 0, right: int = 0) -> int:
"""
Iterate through the array to find the index of key using recursion.
:param list_data: the list to be searched
Expand Down
4 changes: 2 additions & 2 deletions searches/linear_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"""


def linear_search(sequence: list, target: int) -> int:
def linear_search(sequence: list[int], target: int) -> int:
"""A pure Python implementation of a linear search algorithm

:param sequence: a collection with comparable items (sorting is not required for
Expand All @@ -33,7 +33,7 @@ def linear_search(sequence: list, target: int) -> int:
return -1


def rec_linear_search(sequence: list, low: int, high: int, target: int) -> int:
def rec_linear_search(sequence: list[int], low: int, high: int, target: int) -> int:
"""
A pure Python implementation of a recursive linear search algorithm

Expand Down
4 changes: 3 additions & 1 deletion searches/sentinel_linear_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
python sentinel_linear_search.py
"""

from __future__ import annotations

def sentinel_linear_search(sequence, target):

def sentinel_linear_search(sequence: list[int], target: int) -> int | None:
"""Pure implementation of sentinel linear search algorithm in Python

:param sequence: some sequence with comparable items
Expand Down