MAD101_-_SP_2025_-_FE_3620.webp
Z

MAD101_-_SP_2025_-_FE_3620.webp

  • Media owner Zoro2001
  • Ngày thêm
☑Kizspy.me
(Choose 1 answer)
(See picture)
☐ A
A. 3
Use the binary search algorithm to find the location of 10 in
the sequence {1, 4, 5, 7, 8, 10, 12}. How many iterations are
needed?
☐ D
B. 2
C. 5
☐ E
D. 4
E. None of the other choices is correct
Back
Next
begin
FUO.sh
sh the exam.
ALGORITHM The Binary Search Algorithm.
procedure binary search (x: integer, a1, a2,..., an increasing integers)
i=1{i is left endpoint of search interval}
jn jis right endpoint of search interval)
while i < j
end
m = [(i + j)/2]
if xam then i := m +1
else j := m
if xa; then location:= i
else location:=0
{location is the subscript of the term equal to x, or 0 if x is not found)

Thông tin

Category
MAD101
Thêm bởi
Zoro2001
Ngày thêm
Lượt xem
7,390
Lượt bình luận
15
Rating
0.00 star(s) 0 đánh giá

Share this media

Back
Bên trên Bottom