matrix.searching_in_sorted_matrix

Functions

main(→ None)

search_in_a_sorted_matrix(→ None)

Module Contents

matrix.searching_in_sorted_matrix.main() None
matrix.searching_in_sorted_matrix.search_in_a_sorted_matrix(mat: list[list[int]], m: int, n: int, key: float) None
>>> search_in_a_sorted_matrix(
...     [[2, 5, 7], [4, 8, 13], [9, 11, 15], [12, 17, 20]], 3, 3, 5)
Key 5 found at row- 1 column- 2
>>> search_in_a_sorted_matrix(
...     [[2, 5, 7], [4, 8, 13], [9, 11, 15], [12, 17, 20]], 3, 3, 21)
Key 21 not found
>>> search_in_a_sorted_matrix(
...     [[2.1, 5, 7], [4, 8, 13], [9, 11, 15], [12, 17, 20]], 3, 3, 2.1)
Key 2.1 found at row- 1 column- 1
>>> search_in_a_sorted_matrix(
...     [[2.1, 5, 7], [4, 8, 13], [9, 11, 15], [12, 17, 20]], 3, 3, 2.2)
Key 2.2 not found