GATE CS 2017, set 1 · Question 48 · Algorithms · Numerical answer (NAT) · 2 marks · no negative marks

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

Answer

Answer 5

Answer from the official GATE CS 2017 answer key.

The step-by-step solution, where available, is part of GATE CS Pro. See what Pro includes