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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 01:40, littlebirdd987
You have a linux system that has a 1000gb hard disk drive, which has a 90gb partition containing an ext4 filesystem mounted to the / directory and a 4gb swap partition. currently, this linux system is only used by a few users for storing small files; however, the department manager wants to upgrade this system and use it to run a database application that will be used by 100 users. the database application and the associated data will take up over 200gb of hard disk space. in addition, these 100 users will store their personal files on the hard disk of the system. each user must have a maximum of 5gb of storage space. the department manager has made it very clear that this system must not exhibit any downtime as a result of hard disk errors. how much hard disk space will you require, and what partitions would you need to ensure that the system will perform as needed? where would these partitions be mounted? what quotas would you implement? what commands would you need to run and what entries to /etc/fstab would you need to create? justify your answers.
Answers: 3
image
Computers and Technology, 23.06.2019 19:50, Aprillove7939
Which feature is selected to practice and save the timing of a presentation
Answers: 1
image
Computers and Technology, 24.06.2019 00:00, Amrinderkhattra
Visualizing a game of “tag” to remember the meaning of contagious
Answers: 3
image
Computers and Technology, 24.06.2019 01:30, jadaroyval
Write a program that asks the user to enter the name of an input file. if the file does not exist, the program should prompt the user to enter the file name again. if the user types quit in any uppercase/lowercase combinations, then the program should exit without any further output.
Answers: 3
You know the right answer?
The binary search algorithm. an: increasing integers) procedure binary search (x: integer, a1,a2,...

Questions in other subjects:

Konu
Mathematics, 29.09.2019 08:30
Konu
Mathematics, 29.09.2019 08:30