Question

1.
2.
3.
4.
Answer (Detailed Solution Below)

Option 2 : 4

Advertisement

Detailed Solution

सही उत्तर 4 है।

Key Points
Helpful?
PrepSnapprepsnap.in • Part -A

Question:

Binary search is applied to a sorted array of 15 distinct elements for a key smaller than every element. How many key comparisons are made? / 15 भिन्न अवयवों वाले क्रमबद्ध ऐरे में प्रत्येक अवयव से छोटी कुंजी के लिए बाइनरी सर्च लगाया जाता है। कितनी कुंजी तुलनाएँ होंगी?

1.
3
2.
4
3.
5
4.
15

Correct Answer: 4

Probes at indices 7, 3, 1, 0 (each comparison moves the high bound left) — 4 comparisons before the search interval empties. / सूचकांकों 7, 3, 1, 0 पर जाँच (हर तुलना high सीमा को बाएँ ले जाती है) — खोज अंतराल खाली होने से पहले 4 तुलनाएँ।

Downloaded from PrepSnap (prepsnap.in)