29 Oct 2007

"Binary Search Algorithm" in Life

I came up with this algorithm in C++ class and got hooked onto it.Its quite interesting algorithm which can applied in real life situations,love life for example. So first let us know about the algorithm,how it works and its characteristics and then relate with a persons life.It is very interesting to know that it searches for a specific characteristic only after sorting them out in a particular fashion.

What is a Binary search algorithm?
Binary search algorithm (or binary chop) is a technique for finding a particular value in a sorted list. It makes progressively better guesses, and closes in on the sought value by selecting the median element in a list, comparing its value to the target value, and determining if the selected value is greater than, less than, or equal to the target value. A guess that turns out to be too high becomes the new top of the list, and a guess that is too low becomes the new bottom of the list. Pursuing this strategy iteratively, it narrows the search by a factor of two each time, and finds the target value. A binary search is an example of a dichotomic divide and conquer search algorithm.A typical use of binary search algorithm can be depicted in the following program.

BinarySearch(A[0..N-1], value, low, high)
if (high value)
return BinarySearch(A, value, low, mid-1)
else if (A[mid] Similarities with Life:
A binary search algorithm searches for a particular aspect/characteristic, here it checks if the middle value of the high and low values is greater or lower than the value provided. Depending upon the relation of the middle value with the given value,it performs or returns a different result ,here sorting the value at top or last position accordingly. Life is like that ! Don't believe me? In any aspect of life, one has to overcome so many things in life inorder to go ahead in life. For that he has to rely on his thinking capabilities and ability to solve a problem quickly and effectively. The algorithm may not apply directly in the sense that he may not have to find out an intermediate between two choices and arrange it in a fashion or something like that. But i reassure you that almost everyone solves a problem with some backup plan in his mind in case that solution does not work out.

The basic way of solving a problem is to classify the problem into smaller identifiable tasks and overcome it one by one instead of overcoming the problem as a whole.It can be related to modular programming where programs are made up of small modules.The reality of a problem is that none likes complexities in life and want to have a simple one.Though some may find it to be challenging in life to meet complexities and accept it to be a part of life,their wish would have been the same - to simplify it as much as possible. Like the binary search algorithm,we humans divide the problems into smaller parts and try to achieve it part by part instead of dealing with it as a whole. Depending upon the complexity of the task,he classifies it as long term,short term or maybe difficult and easy tasks. Then after sorting the tasks he tries to achieve them one by one and altogether try to create the overall result expected out of it. He wishes to give the expected result depending on the complexity he handled during the procedure.

British also did the same when they ruled India -divide and rule policy. we humans do it in our day to day lives so often that we have lost insight of it. Jokes apart we humans also try to gain someones love using such algorithms or policies. Set one against another and gain from their their enmity. Who doesn't use it nowadays - politicians,crazy lovers,mathematicians,physicist etc. In fact searching of brides use this algorithm. Obtain background of the bride/groom and set an expected characteristics of the groom/bride,sort them out in order of preferences and then finally select the one most suitable. Or in shopping where we select things out of quality,price or some other things and compare it with the nominal ones.Upon sorting out in order,one buys the one which suits him the best in terms of money,quality or performance.

Everyone lives a life out of experiences and forgets the real nature of life. He counts more on his experiences rather than his senses and thoughts in life. Maybe thats why we fail to recognize these steps,methods and algorithms we use in life and unable to accept it even though one would tell them. Like Al Pacino in Scent of a woman who believed in his own ability to do his own work without help,we should try to develop these senses that has been long learnt yet forgotten and go ahead in life with these senses too. His beliefs,his thoughts,his wishes all stand out in his speech in the last instance. he could see the potential in the boy even though he was blind. He did not went for his experiences and thoughts for the boy but used his senses in him to determine what kinda boy he was and stood for him till the end and brought him glory and pride. Some lessons are taught by movies too,don't u think so?

Written with some help from Wikipedia


comments powered by Disqus