Question

Please implement a Java program to use Binary Search to search 10000 times of the number...

Please implement a Java program to use Binary Search to search 10000 times of the number 23 from

2 5 8 12 16 23 38 56 72 91
0 0
Add a comment Improve this question Transcribed image text
Answer #1
1)  step 1
2 5 8 12 [16] 23 38 56 72 91
middle element is 16.

2)  step 2
23 38 [56] 72 91
middle element is 56.

3)  step 3
[23] 38
middle element is 23.

so, it takes 3 steps to finding 23 using binary search in the array.

searching 10000 times takes 3*10000 = 30000 steps.

Answer: 30000
Add a comment
Know the answer?
Add Answer to:
Please implement a Java program to use Binary Search to search 10000 times of the number...
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
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