adplus-dvertising
frame-decoration

Question

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________.

a.

2

b.

3

c.

4

d.

5

Answer: (d).5

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. 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...

Similar Questions

Discover Related MCQs

Q. The complexity of multiplying two matrices of order m*n and n*p is

Q. Merging 4 sorted files containing 50, 10, 25 and 15 records will take____time.

Q. An algorithm is made up of two independent time complexities f (n) and g (n). Then the complexities of the algorithm is in the order of

Q. Ackerman’s function is defined on the non-negative integers as follows
a (m,n) = n+1 if m=0
= a (m-1, 1) if m ≠ 0, n=0
= a (m-1, a(m, n-1)) if m ≠ 0, n ≠ 0
The value of a (1, 3) is

Q. What is a set of steps for carrying out a specific task called?

Q. A real world example of an algorithm would be a___________.

Q. Who should know about the basic algorithmic toolbox structures that allow efficient organization and retrieval of data frequently used algorithms and basic techniques for modeling, understanding and solving algorithmic problems?

Q. Algorithms are at the heart of every non-trivial computer application and also a modern and active area of ____________.

Q. Operations performed on scalar quantities are termed simple, while operations on vector data normally termed as_______.

Q. An algorithm may have __________‘inputs’ quantities.

Q. ___________ refers to a finite set of steps, which, when followed, solves a particular problem.

Q. The two main resources that we consider for an algorithm are__________.

Q. Space complexity of an algorithm is the maximum amount of _______ required by it during execution.

Q. Frequently, the memory space required by an algorithm is a multiple of the size of input. State if the statement is True or False or Maybe.

Q. For many problems such as sorting, there are many choices of algorithms to use, some of which are extremely___________.

Q. In the analysis of algorithms, what plays an important role?

Q. An algorithm performs lesser number of operations when the size of input is small, but performs more operations when the size of input gets larger. State if the statement is True or False or Maybe.

Q. To verify whether a function grows faster or slower than the other function, we have some asymptotic or mathematical notations, which is_________.

Q. A function in which f(n) is Ω(g(n)), if there exist positive values k and c such that f(n)>=c*g(n), for all n>=k. This notation defines a lower bound for a function f(n):

Q. An algorithm that indicates the amount of temporary storage required for running the algorithm, i.e., the amount of memory needed by the algorithm to run to completion is termed as_____.