Illustration of binary search, MATLAB in Statistics

Illustration of Binary search:

An illustration to search for the key of 91 in the vector is as shown below:

1451_Illustration of Binary search.png

The table below shows what will happen in each iteration of this search algorithm.

64_Illustration of Binary search1.png

The key found in the fourth element of the vector.

Another illustration: search for the key 82:

494_Illustration of Binary search2.png

The value of low cannot be greater than high; this means that the key is not in the vector. Therefore, the algorithm repeats until either the key is found or until low > high, that means the key is not there.

Posted Date: 10/22/2012 8:01:04 AM | Location : United States







Related Discussions:- Illustration of binary search, Assignment Help, Ask Question on Illustration of binary search, Get Answer, Expert's Help, Illustration of binary search Discussions

Write discussion on Illustration of binary search
Your posts are moderated
Related Questions
Illustration of Binary search: An illustration to search for the key of 91 in the vector is as shown below: The table below shows what will happen in each iteration of

Mode The mode of a data set is the value which appears most often. The built-in function in a MATLAB for this is known as the mode. >> x = [9 10 10 9 8 7 3 10 9 8 5 10];

Help function: Function is computing the two values, there are two output arguments in the function header (i.e., area & circum), that are placed in the square brackets [ ]. A

Advanced File Input and output: Where 'format' involves the conversion characters much like those used in the fprintf function. For illustration, to read the file 'subjexp.dat

Properties of the text box - graphics objects: By using get will show properties of the text box, the illustration is as shown below: >> get(thand)   BackgroundColor

Location of a rectangle - graphics objects: The location of a rectangle is [x y w h], where x and y are the coordinates of the lower left point, here w is the width, and h is

Example of customizing plots: As the other illustration of customizing plots, the pieces of a pie chart can be "exploded" from the rest. In this situation, the two vectors are

Use of function polyval: The better the curve fit, the more exact these interpolated and extrapolated values will be. By using the subplot function, we can loop to display the

Advanced File Input and Output: In that section, we saw how to read the values entered by user using the input as well as the output functions disp and fprintf, that shows inf

bjjh