GATE CS 2017 · Set-1 · Linear Search & Binary Search

NAT · 2 marks · Problem PROG-SRCH-0014

Let A be an array of 31 numbers consisting of sequence of 0's followed by a sequence of 1's. The problem is to find the smallest index i that A[i] is 1 by probing the minimum numbers of locations in A. The worst case number of probes performed by an optimal algorithm is .

Numerical answer (NAT).

Solve it on GATE DA practice →More Searching & Sorting Algorithms problems

Show the worked solutionOfficial GATE Answer Key: [5.0, 5.0].See full step-by-step discussion on GateOverflow: https://gateoverflow.in/118331/gate2017-1-48

GATE DA practice: past exam problems by chapter, with worked solutions · gatedaprep.com