subject

The binary search algorithm. an: increasing integers) procedure binary search (x: integer, a1,a2, i: = 1 {i is left endpoint of search interval } = n {j is right endpoint of search interval} while ij i#x > am then i : = m + 1 else j : = m if x = ai then location : = i else location : = 0 return location location is the subscript i of the term a equal to x, or 0ifx is not found) 26. change algorithm 3 so that the binary search procedure compares x toam at each stage of the algorithm, with the algorithm terminating if x = am, what advantage does this version of the algorithm have? 2. (20 points) exercise 26, p. 203. provide pseudocode and complexity for this algorithm. change algorithm 3, p. 195, so that the binary search procedure comparesr to am at each stage of the algorithm, with the algorithm terminating if am (a) write what an advantage has this version of the algorithm. (b) write a formula for a function which expresses the number of comparisons for the elements of a sorted sequence , an against the target z in the worst and the best cases. (c) classify the algorithm in the worst case using the big-o asymptotic notation.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 22:00
Which one of the following would administrators use to connect to a remote server securely for administration? a. telnetb. secure file transfer protocol (sftp)c. secure copy (scp)d. secure shell (ssh)
Answers: 1
question
Computers and Technology, 23.06.2019 10:30
How would you categorize the software that runs on mobile devices? break down these apps into at least three basic categories and give an example of each.
Answers: 1
question
Computers and Technology, 23.06.2019 19:00
Whose task it is to ensure that the product flows logically from one step to another?
Answers: 3
question
Computers and Technology, 24.06.2019 09:00
Technician a says that a new replacement part is always good. technician b says that sometimes recent repair work will be the cause of a complaint. who is correct? a. both technicians a and b b. technician a c. technician b d. neither technician a nor b
Answers: 3
You know the right answer?
The binary search algorithm. an: increasing integers) procedure binary search (x: integer, a1,a2,...
Questions
question
Social Studies, 10.01.2020 05:31
question
Mathematics, 10.01.2020 05:31
question
Mathematics, 10.01.2020 05:31
Questions on the website: 13722361