Our modern lives have seemingly been taken over by algorithms.
They figure in just about every aspect of our existence where decisions are made but we may not always be conscious of their function or even presence.
They may seem like a relatively new phenomena and only really in their element with the surge in personal and portable computer power but they predate our technology age by thousands of years.
The Ancient Greek mathematician Euclid is regarded as the father of the algorithm being one of the pre-eminent thinkers and theorists of his era and for many generations after.
We may feel inclined to demonise the algorithm because many of us, including myself, remain in the dark about their applications although we should embrace them because they have the sole purpose of teaching us to make more efficient decisions in everyday situations.
We actually use algorithms without knowing it.
Take the simple domestic chore of sorting out your sock drawer.
If yours is anything like mine it is a complete mess, a tangled nest of unsorted, odd, mismatched and unloved socks. Sorting would be so easy if all of your socks were just the same type in terms of colour, length, style and size. A typical collection of socks is likely to be multi-coloured in terms of black, blue, green, beige, white and with further shades at toes, heel and tops.
The basic level algorithm is simply to pull out a single sock and then another to see if there is a match. A failed sample is just put back and the process continues.
That is all very well if you have time to spare but otherwise it is just not a very good allocation of time and labour.
A more efficient algorithm is the radixsort.
This divides the sock drawer contents into a number of categories along the lines of their basic sizes and colours. Each group or "bucket" as computer terminology refers grows steadily and they are then merged into smaller groups until a final definitive and identical pairing is achieved.
A better known algorithm is the bubblesort.
This works on the principle of pairs of things in a series of progessive steps. The best application by which bubblesort was clarified in my mind relates to a sorting of books by author in alphabetical order. You just swap them into the correct order one by one.
If you are involved in a far larger project, say the sorting of 100 million census cards or larger pools of data then you would be better served using the mergesort.
This system was for many years classified as top secret of the US military but now released into the public domain it has found a firm place in many algorithm applications.
It has some similarities to bubblesort but works on putting items into a repetitive order.
Using the excuse of alphabetising your books, CD's or DVD's this is what you do.
First form lots of piles of pairs of respective items in alphabetical order. Merge each pile with it's neighbour and repeat until completed.
Incidentally it has been calculated that to sort the aforementioned huge volume of census cards would take only 29 steps in a mergesort.
So, the algorithm is here to stay but then again, it has evidently always been around not just as a whim of Man but as an elemental component of just about everything....., ever.
No comments:
Post a Comment