Sorted list using binary search technique, Data Structure & Algorithms

Assignment Help:

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];

 


Related Discussions:- Sorted list using binary search technique

Linked lists, representation of links list in memory

representation of links list in memory

Data manipulation, perform the following length operation LENGTH("welcome t...

perform the following length operation LENGTH("welcome to ICA")=

Determine the components of illumination, Determine the Components of Illum...

Determine the Components of Illumination The light reaching the eye when looking at a surface has clearly come from a source (or sources) of illumination and bounced off the su

Euclidean algorithm, The Euclidean algorithm is an algorithm to decide the ...

The Euclidean algorithm is an algorithm to decide the greatest common divisor of two positive integers. The greatest common divisor of N and M, in short GCD(M,N), is the largest in

Adjacency matrix representation of a graph, An adjacency matrix representat...

An adjacency matrix representation of a graph cannot having information of : Parallel edges

Efficiency of linear search, Efficiency of Linear Search How much numbe...

Efficiency of Linear Search How much number of comparisons is there in this search in searching for a particular element? The number of comparisons based upon where the reco

Flowcharts, draw a flowchart which prints all the even numbers between 1-50...

draw a flowchart which prints all the even numbers between 1-50

Asymptotic analysis, Asymptotic Analysis Asymptotic analysis is dependi...

Asymptotic Analysis Asymptotic analysis is depending on the idea that as the problem size grows, the complexity can be defined as a simple proportionality to some known functio

Define a procedure called make-avl-tree, This question deals with AVL trees...

This question deals with AVL trees. You must use mutable pairs/lists to implement this data structure: (a) Define a procedure called make-avl-tree which makes an AVL tree with o

Merging 4 sorted files containing 50, Merging 4 sorted files having 50, 10,...

Merging 4 sorted files having 50, 10, 25 and 15 records will take time  O (100)

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd