master > master: code - minor
This commit is contained in:
parent
e03f07d555
commit
a706faa8b8
@ -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:
|
||||
|
@ -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]):
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user