Examveda

Choose the correct while loop statement from the following that finds the range where are the element being search is present (x is the element being searched in an array arr of size n)?

A.

while (i < n && arr[i] <= x)  
        i = i*2; 

B.

while (i < n && arr[i] <= x)  
         i = i/2; 

C.

while (arr[i] <= x)  
        i = i/2; 

D.

while (i < n)  
        i = i*2; 

Answer: Option A


This Question Belongs to Data Structure >> Searching Algorithms

Join The Discussion

Related Questions on Searching Algorithms