Question

Please CLEARLY STATE THE ANSWER and try to make it too long please. How many comparisons...

Please CLEARLY STATE THE ANSWER and try to make it too long please. How many comparisons will it take for the binary search to find the number 17 in the list of numbers 1 4 5 7 8 17 21 24 28 29 31 37 39? Show your work.

0 0
Add a comment Improve this question Transcribed image text
Answer #1
1)
1 4 5 7 8 17 21 24 28 29 31 37 39
compare 17 with the middle element(21). 
17 < 21.
so, ignore right half of the list

2)
1 4 5 7 8 17
compare 17 with the middle element(7). 
17 > 7.
so, ignore left half of the list

3)
8 17
compare 17 with the middle element(17). 
17 = 17.
so, 17 is found using binary search in 3 steps.
Add a comment
Know the answer?
Add Answer to:
Please CLEARLY STATE THE ANSWER and try to make it too long please. How many comparisons...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • How many comparisons will it take for the binary search to find the number 17 in...

    How many comparisons will it take for the binary search to find the number 17 in the list of numbers 1 4 5 7 8 17 21 24 28 29 31 37 39?

  • explain how to get the answer A to this question. ^Binary Trees - Number of Compares...

    explain how to get the answer A to this question. ^Binary Trees - Number of Compares ~Given the following numbers in array A ... 7 34 12 28 33 21 15 24 29 ... and using these numbers to draw a Binary Tree, how many compares will it take to find the 21? a. 5 b. 4 c. 6 d. 7 e. 9

  • C++ Sorting and Searching 1. Mark the following statements as true or false. a. A sequential...

    C++ Sorting and Searching 1. Mark the following statements as true or false. a. A sequential search of a list assumes that the list elements are sorted in ascending order. b. A binary search of a list assumes that the list is sorted. 2. Consider the following list: 63 45 32 98 46 57 28 100 Using a sequential search, how many comparisons are required to determine whether the following items are in the list or not? (Recall that comparisons...

  • I know how to do number one just not number 2. Please answer number 2 only...

    I know how to do number one just not number 2. Please answer number 2 only Write a java program that will print out following pattern. Use nested for loop. 2. Add a method to the above program that generates takes two numbers as parameters and prints out all the numbers from number 1 to number 2 separated by using a while loop. (Do not print the last ,'). For example: Calling method1(9,51) should print: 9, 10, 11, 12, 13,...

  • hheeelppp copying and comparing QUESTION 24 How many comparisons does insertion sort make on an input...

    hheeelppp copying and comparing QUESTION 24 How many comparisons does insertion sort make on an input array that is already sorted? O(1) O(n) o(na) O(log n) 4 QUESTION 25 A linear list of elements in which deletion can be done from one end and insertion can take place only at the othe Queue Stack Array Click Save and Submit to save and submit. Click Save All Answers to save all answers HUAWEI

  • i dint think the answer is corect. Catistics, E... X - JJ Prepare a stem-and-leaf display...

    i dint think the answer is corect. Catistics, E... X - JJ Prepare a stem-and-leaf display for these data. Arrange the leaves for each stem in increasing order. Prepare a split stem-and-leaf display for these data. Split each stem into two parts. The first part should contain the contain the leaves 5 through 9. 29 The following data give the one-way commuting times (in minutes) from home to work for a random sample of 50 23 17 34 26 18...

  • Determine how many CH2 and CH3, CH and C (no hydrogen) groups are in the molecule....

    Determine how many CH2 and CH3, CH and C (no hydrogen) groups are in the molecule. and how many proton groups are there. Does the spectra agree with this? Cholesterol in CDC13 Proton spectrum AAA M. T T 40 0.5 5 5,0 4.5 3.5 3.0 25 2.0 1,5 14 0 f1 (ppm) Cholesterol in CDC13 Carbon Spectrum ..demel. 135 130 80 10 50 145 140 125 120 115 110 105 100 95 90 85 70 75 f1 (ppm) 65 60...

  • Q1) Twenty six smokers were surveyed to ascertain the number of cigarettes each smoked for a 1 we...

    please answer 1 and 2 in detail Q1) Twenty six smokers were surveyed to ascertain the number of cigarettes each smoked for a 1 weelk period. The results are as follows: 44 39 37 21 31 28 44 29 30 52 40 20 24 32 22 27 50 43 26 37 26 51 34 27 33 25 Create a frequency distribution with 5 classes using the headings: #ofcigarettes. Frequency(), Cumulative Frequency (c), and relative frequency (r). Show details of your...

  • Please show work! 2. Now, give it a try by converting the binary number 01110110 to...

    Please show work! 2. Now, give it a try by converting the binary number 01110110 to decimal by filling in the same table in step 1 r of 2 Pov 128 64 32 16 Cumulative Amount 4. Now, you give it a try by converting the decimal number 131 to binary by filling in the table Power of 2 128 32 16 Bit Amount Remaining 6. Use the binary to hexadecimal table to convert the binary number 01101111 to hexadecimal...

  • Note: Answer the Question(s) by Using the TI-30XA (or other approved) Calculator. IMPORTANT: Make...

    Note: Answer the Question(s) by Using the TI-30XA (or other approved) Calculator. IMPORTANT: Make sure you carry all decimals until you reach your answer, then round to four decimals. 10 12 13 A consultant for a large university studied the number of hours per week freshmen watch TV versus the number of hours seniors do. The results of this study follow. Is there enough evidence to show the mean number of hours per week freshmen 15 watch TV is different...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT