Commit 3df3a2a4 authored by Mareš Martin's avatar Mareš Martin
Browse files

Doplněno binarni-hledani-print

parent 6a116181
#!/usr/bin/env python3
# Binární vyhledávání v setříděném seznamu
kde = [11, 22, 33, 44, 55, 66, 77, 88]
co = int(input())
# Hledané číslo se nachazí v intervalu [l, p]
l = 0
p = len(kde) - 1
while l <= p:
stred = (l+p) // 2
print(f"[{l},{p}] {kde[stred]}")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment