Skip to main content

HOW TO SEARCH

   


The search method that we are going to explore belongs to computers.  But it can be used in many real-life situations like crime investigation, eliciting an answer in an enquiry  etc,.  

     Consider a set of alphabetically arranged strings as given below.
1. ABC
2. BCD
3. CDE
4. DEF
 5. EFG
6. FGH
7. GHI
 8. HIJ
9. IJK
10. JKL
11. KLM
12. LMN
13. MNO

 I want to find the location of KLM.   Select the middle string in the list.  That is 7. GHI.  Since KLM is less than GHI, KLM must be present below it not above it.  So leave out the strings above 7.  Now we are left with, 
7. GHI
8.HIJ
9. IJK
10.JKL
11.KLM
12.LMN
13. MNO
  Now again go for the middle element which is 10.JKL.    Again KLM is less than JKL.  Hence leave out the top- half of the list.  Now we are left with,
10. JKL
11. KLM
12. LMN
13. MNO
 Now, if you select the middle element, you will land in KLM and its location is 11.  So we made it in 3 steps.

This kind of searching  is called binary searching.  Since we divide the list into 2 halves every time and leave out one half each time.  This is one of the fastest searching methods.  Suppose you want to search a data base of 100000 names.  In the first step we can eliminate 50000 names  and in the second step, 25000 names and so on.
 Say, a crime is committed and you want to find the culprit.  The investigating inquiry with the concerned people may go on as given below.

q1. Is the culprit alive or dead?
q2. Is the person man or woman?
q3. Is he /she known or unknown person?
q4. Is the person belongs to this town or not
q5. Is he /she belongs to your family or your office?
 In each question, we eliminate so many number of suspects and finally may zero in on the enemy.

     Long time ago, there was a television show by name 'what is in your mind?'.  The participant in the show has to think of a celebrity's name.  The expert shoots 15 questions to the participants one by one and ultimately finds out the name in the mind.  The questions were mainly based on binary elimination method.       

Comments

  1. I remember a scene of a movie, where the guy finds out the address of a Girl's college based on just a book with her and the local train that she catches during her morning sojourn.
    Indeed a simple and effective method to search a required data.

    ReplyDelete

Post a Comment

Popular posts from this blog

THE EARTH, A SUPER ORGANISM

     JOIN MY COURSE: "Become a programmer in a day with python"       A man called 'love lock' (what a name) proposed a theory called Gaia theory, named after Greek Goddess.      It says, "Earth is a self-regulating organism like a human being.  The organic life in it interacts with in-organic matter and maintains atmosphere, temperature and environment".  Hence the earth is still suitable for the life to thrive.      Imagine, in a particular place, there are lot of flowers.  Some flowers are white and some are darkly coloured.  We know, white reflects light and heat while dark absorbs the same.  White flowers can thrive in hot climate.  But dark flowers requires cold climate.  The absorption and reflection balances and the environment reaches average, warm temperature at which both the flowers can co-exist.  This is the essence of "Gaia" theory.      On our earth, ...

THE PARABOLA

          A jet of water shooting from a hose pipe will follow a parabolic path.  What is the so special about parabola.    Y= x^2 Draw a graph for the above equation.  It will result in a parabola.  This parabola is also called unit parabola.  Any equation involving square will yield a parabola. Example:  Y = 2x^2 +3x+3 (also called quadratic equation)    X= 2 and -2, both  satisfies the equation 4 = X^2.  Parabolic equations always have two solutions.     Any motion taking place freely under gravity follows parabolic path. Examples:   An object dropped from a moving train,   A bomb dropped from flying plane,  A ball kicked upwards.      If a beam of light rays fall on the parabolic shaped mirror, they will be reflected and brought to focus on a point.  This fact is made use of in Dish Antenna, Telescope mirrors, etc.   ...

DISORDER IS THE "ORDER OF THE DAY"

         Imagine a balloon full of air.  The air molecules are moving randomly inside the balloon.  Let us pierce the balloon with a pin.  The air rushes out.  Why should not the air molecules stay inside the balloon safely and ignore the little hole?  That is not the way the world works.  The molecules always "want to occupy as many states as possible".  Hence the air goes out in the open to occupy more volume.   The things always goes into disorder (entropy) and the disorder increases with time.  The above statement is what we call "second law of thermodynamics".      Consider a cup of coffee on the table. Suppose the heat from entire room flows to your cup of coffee, the coffee will boil and the rest of the room will freeze.  Freezing means bringing things to order and arrangement.  It violates the second law.  Hence it will never happen.  Hence heat must flow from high ...