write an algorithm for searching a key from a


Write an algorithm for searching a key from a sorted list using binary search technique

1.   if (low > high)

2.     return (-1)

3.    mid = (low +high)/2;

4    .if ( X = = a [mid])

5      return (mid);

6     if ( X < a [mid])

7    search for X in a (low) to [mid -1];

8    else

9     search for X in a [mid + 1] to a [high];

 

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: write an algorithm for searching a key from a
Reference No:- TGS0282797

Expected delivery within 24 Hours