Computers and Technology
Computers and Technology, 29.06.2021 16:20, 719729

By now you should be convinced that binary search requires fewer comparisons than linear search in both the worst case and the average case. However, keep in mind that binary search assumes that the elements are already in sorted order; if they’re not sorted, then it would take time to sort them before applying binary search, and sorting is a slow operation. Whereas the number of operations in the worst case to conduct binary search on a collection of N items is approximately {\log_2 N}log 2 ​ N, the number of operations required to sort N items is {N\log_2 N}Nlog 2 ​ N, i. e., the value of N times its base-2 logarithm. Assume you have an unsorted collection of N = 15 items, and you know you will need to make at least 10 searches and are concerned about the worst case. How would you determine whether it would be better to conduct 10 linear searches, or if it would be better to first sort the elements (which you only need to do once) and then conduct 10 binary searches? In making this decision, follow these steps: First, calculate the number of operations it would require to conduct 10 linear searches in the worst case. Then, calculate the number of operations it would require to sort the elements once; for simplicity, round {\log_2 15}log 2 ​ 15 up to 4. Last, calculate the number of operations it would require to conduct 10 binary searches in the worst case. Use the results of these three calculations to determine the answer.

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 18:40, jennsou
Adna sequence encoding a five-amino acid polypeptide is given below. …… …… locate the sequence encoding the five amino acids of the polypeptide, and identify the template and coding strand.
Answers: 1
image
Computers and Technology, 22.06.2019 15:30, coollid876
To increase sales, robert sends out a newsletter to his customers each month, letting them know about new products and ways in which to use them. in order to protect his customers' privacy, he uses this field when addressing his e-mail. attach bcc forward to
Answers: 2
image
Computers and Technology, 22.06.2019 19:20, sindy35111
Terri needs to insert a cover page into her document. where should she go to access the commands to do so? o insert tab, objects group o insert tab, illustrations group o insert tab, pages group o insert tab, media group submit
Answers: 1
image
Computers and Technology, 22.06.2019 22:20, gingerham1
Avariable of the data type arrays is storing 10 quantities. what is true about these quantities? a. the quantities all have different characteristics. b. the quantities all have the same characteristics. c. five quantities have the same and five have different characteristics. d. it is necessary for all quantities to be integers. e. it is necessary for all quantities to be characters.
Answers: 2
Do you know the correct answer?
By now you should be convinced that binary search requires fewer comparisons than linear search in b...

Questions in other subjects: