Computers and Technology
Computers and Technology, 15.05.2021 22:30, fezez5304

In this exercise you will explore the performance difference between sequential search and binary search. To do so write a program that performs the following tasks: Prompt the user for a file containing 100,000 unsorted integers

Read those integers into an array

Prompt the user for a search item

Search for that item (using sequential search) and report the number of comparisons required.

Sort the array. Note that this will take about a minute.

Search for that item again (using binary search) and report the number of comparisons required.

You will need to modify both of the search functions to report the number of comparisons that were made during the search.

Use your program and the file of 100,000 integers provided here to answer the six questions in the quiz.

Question 1
Question text
Was search item 20000 found?

Select one:
True
False

Question 2
How many comparisons did sequential search make while searching the list for the value 20000?



Question 3
How many comparisons did binary search report in the search for 20000?



Question 4
Was the value 45000 found in this list?

Select one:
True
False

Question 5
How many comparisons were made by sequential search while searching for 45000?



Question 6
How many comparisons were made by binary search while searching for 45000?

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 11:00, jolleyrancher78
What are the possible consequences of computer hacking? what is computer piracy? describe some examples. what are the effects of computer piracy? what are the possible consequences of computer piracy? what is intentional virus setting? describe some examples. what are the effects of intentional virus setting? what are the possible consequences of intentional virus setting? what is invasion of privacy? describe some examples. what are the effects of invasion of privacy? what are the possible consequences of invasion of privacy? what is an acceptable use policy and what is the purpose of the acceptable use policy what is intellectual property and how can you use it?
Answers: 1
image
Computers and Technology, 24.06.2019 16:30, saadshami2384
You may see the term faq on websites which stands for frequently asked questions this is an example of which type of mnemonic? a) poem b) acronym c) acrostic d) abbreviation ken has dipped many dark chocolate marshmallows (which you remember the metric system distance units in decreasing order: kilometers, hectometer, decameter, centimeter, millimeter) is an example of which type of mnemonic? a) poem b) acronym c) acrostic d) abbreviation !
Answers: 1
image
Computers and Technology, 24.06.2019 17:40, penacesar18p9jrdh
The value of sin(x) (in radians) can be approximated by the alternating infinite series create a function (prob3_2) that takes inputs of a scalar angle measure (in radians) and the number of approximation terms, n, and estimates sin(x). do not use the sin function in your solution. you may use the factorial function. though this can be done without a loop (more efficiently), your program must use (at least) one. you may find the mod() function useful in solving the problem.
Answers: 1
image
Computers and Technology, 24.06.2019 21:00, gabrielaperezcz
How does a vaccine prevent sickness and individual?
Answers: 2
Do you know the correct answer?
In this exercise you will explore the performance difference between sequential search and binary se...

Questions in other subjects:

Konu
Mathematics, 07.05.2021 16:20