From a706faa8b8f0dbcd8f8da3d5b2e93a368f88f3ca Mon Sep 17 00:00:00 2001 From: raj_mathe Date: Sun, 24 Oct 2021 13:18:39 +0200 Subject: [PATCH] master > master: code - minor --- code/algorithms/search/binary.py | 2 ++ code/algorithms/search/interpol.py | 2 ++ code/algorithms/search/jump.py | 6 ++++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/code/algorithms/search/binary.py b/code/algorithms/search/binary.py index bb2dfdc..3ef9901 100644 --- a/code/algorithms/search/binary.py +++ b/code/algorithms/search/binary.py @@ -38,7 +38,9 @@ def postChecks(L: List[int], x: int, index: int, **_): def BinarySearch(L: List[int], x: int) -> int: ''' Inputs: L = Liste von Zahlen, x = Zahl. + Annahme: L sei aufsteigend sortiert. + Outputs: Position von x in L, sonst −1 wenn x nicht in L. ''' if len(L) == 0: diff --git a/code/algorithms/search/interpol.py b/code/algorithms/search/interpol.py index c048149..b0efc2e 100644 --- a/code/algorithms/search/interpol.py +++ b/code/algorithms/search/interpol.py @@ -38,7 +38,9 @@ def postChecks(L: List[int], x: int, p: int, **_): def InterpolationSearch(L: List[int], x: int, u: int, v: int) -> int: ''' Inputs: L = Liste von Zahlen, x = Zahl, [u, v] = Suchinterval. + Annahme: L sei aufsteigend sortiert. + Outputs: Position von x in L, sonst −1 wenn x nicht in L. ''' if not(L[u] <= x and x <= L[v]): diff --git a/code/algorithms/search/jump.py b/code/algorithms/search/jump.py index 9aaea43..eac95f9 100644 --- a/code/algorithms/search/jump.py +++ b/code/algorithms/search/jump.py @@ -40,9 +40,11 @@ def postChecks(L: List[int], x: int, index: int, **_): def JumpSearchLinear(L: List[int], x: int, m: int) -> int: ''' Inputs: L = Liste von Zahlen, x = Zahl, [u, v] = Suchinterval. + Annahmen: - - L sei aufsteigend sortiert. - - L enthält keine Duplikate. + - L sei aufsteigend sortiert. + - L enthält keine Duplikate. + Outputs: Position von x in L, sonst −1 wenn x nicht in L. ''' i = 0;