Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Martin Mareš
prm1
Commits
3df3a2a4
Commit
3df3a2a4
authored
Oct 25, 2019
by
Martin Mareš
Browse files
Doplněno binarni-hledani-print
parent
6a116181
Changes
1
Hide whitespace changes
Inline
Side-by-side
04-trideni/binarni-hledani-print.py
100644 → 100755
View file @
3df3a2a4
#!/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
]
}
"
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment