Computer Science, asked by shahanathasleem8869, 1 year ago

Find the average number of key comparisons made by binary search

Answers

Answered by chaitanyakrishn1
0
U should elaborate the question

Anonymous: the average number of key comparisons in binary search is (n-1)
Anonymous: Well it's a guess
Answered by dimpy521
0
ts 2.9 on average; the question asked average number of comparisons on binary search; so as per algo first the middle, then since it is sorted while computing for the middle and equating to it at the same time it is determined which way to go further left or right;

1 2 3 4 5 6 7 8 9 10
For 5: 1
For 2,8 : on second comaprison, i.e., 2
And similarly
For 1,3,6,9: 3
And for 4,7,10: 4

compute it:1×1+2×2+4×3+3×410=2.9
Similar questions