subject

Make a sorted integer array a[i]=i, i=0,…,n-1. Let bs(a, n,x) be a binary search program that returns the index i of array a[0..n-1] where a[i]=x. Obviously, the result is bs(a, n,x)=x, and the binary search function can be tested using the loop:
for(j=0; j for(i=0; i
Select the largest n your software can support and then K so that this loop with an iterative version of bs runs 3 seconds or more. Then measure and compare this run time and the run time of the loop that uses a recursive version of bs. Compare these run times using maximum compiler optimization (release version) and the slowest version (minimum optimization or the debug version). If you have a desktop machine, use it. If you must use a laptop, make measurements using AC power, and then the same measurements using only the battery.
What conclusions can you derive from these experiments? Who is faster? Why? What is the time for executing a single bs program? If you have different compilers you can compare them.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 20:00
The blank button automatically displays next to the data when you select a range of numeric data which is an available option for creating a chart
Answers: 3
question
Computers and Technology, 23.06.2019 00:30
Write the html code to make a link out of the text “all about puppies”. it should link to a pdf called “puppies.pdf” inside the “documents” folder. the pdf should open in a new window.
Answers: 2
question
Computers and Technology, 23.06.2019 04:31
This graph compares the cost of room and board at educational institutions in texas.
Answers: 1
question
Computers and Technology, 23.06.2019 17:30
What are the most commonly found items in the trash according to the municipal solid waste report?
Answers: 1
You know the right answer?
Make a sorted integer array a[i]=i, i=0,…,n-1. Let bs(a, n,x) be a binary search program that return...
Questions
question
Mathematics, 20.07.2019 19:00
question
English, 20.07.2019 19:00
Questions on the website: 13722360