Thursday, 26 November 2015

Sorting, the burning problem in hand...

After the introductory articles and preaching about Algorithms, Let's discuss about some practical scenarios where analysis of algorithms plays a key role.

Let's start our discussion with a simple thought. We all know about Dictionary and what it does, right ?

Oh yeah, dictionary is a place where we find the meaning of any word.

Good, now let me ask you the meaning of the word 'Modern'. So, what are you going to do ?

Hey, I will search the dictionary, probably in the middle of the pages. Cause, 'M' is almost in the middle of the dictionary.

Then I will look up at any word, let's say I found the word 'Modest' in that page, then I will look in the previous page, cause 'R' comes before 'S' and accordingly in some other 2/3 steps, I will find the word 'Modern'.

So, that's it, usually anyone in the world will basically do that. Because all of us know that the worrds are arranged in some particular fashion in the dictionary. We basically call this fashion as 'Sorted'.

Now, I would like you to put some overhead on the same problem. Just think that, the dictionary is not sorted at all and may be the dictionary has the following order of words,

Good, Place, Algorithm, Program, Zebra, Work, Bat, Cow, Ball, Billiards, Efficient, Alphabet, Access, Sort, Order, Monotonous, Migration, Immigration, External, Pouch, Internal ...........

Now, I ask you to find the meaning of the word 'Modern' from our this new dictionary.

Ohh Jesus !!! I can't do that. Please forgive me.
Well, that is what happens at a first glance, but if you think quietly, you will realize that you can find the meaning of any word from this dictionary too. Only thing you have to do is, you have to check all the words in the dictionary, until you get the word you are searching for.

Wait, that's basically none of use. If I cannot find a meaning when I require it, what is the use of finding it out ? Rather I will buy a new dictionary instead of using yours inefficient dictionary.
Here is $5 for you to buy the dictionary. ;)

Yes, that is what we basically want, a faster way to make things better and get the required element at ease.

Well, it is true that, 'Getting a right answer late is same as getting a wrong answer'.

That's where lies the beauty of sorting. Mostly, sorting helps in following two ways,
  1.  Easing the process of looking up an element from the pile
  2.  Enhancing the process of merging sequences
So, in today's world data has become huge, here is an article depicting the scenario. Just check the article and get an understanding, how huge the data has become globally. So, to find out the exact information from this data, we need a better and efficient way of searching the exact information from this huge pile of data.

Sorting helps this process in an efficient way. So, to cope up with the large data collection, we need efficient sorting process.

So, sorting has become a burning problem of today and in future also, it will be. Somewhere, I read this quote, 'We need an efficient sorting algorithm every one and half years'.

Hope that, you got an understanding on the usability of sorting. Next, we will be looking into some sorting algorithms and will analyze them.

Prev     Next
Palash Kanti Kundu

No comments:

Post a Comment