DEV Community

loading...

Algorithm === Imagination

alokozai profile image Qaiss Alokozai ・2 min read

I debate with friends that CS is more relevant to our imagination. If I ask non CS that; find 6 out of this list [1,2,3,4,5,6]. He will surely tell me well that it is pointing with his finger to 6. Now, if we ask further, well it is easier in this context as we have just 6 elements, what if I give you one million elements then what? For sure, then after a bit thinking there will be another answer which is better than before (I have tested my non CS friends and they have given exceptional answers).

Look at binary search: [1,2,3,4,5,6,7,8,9,10], non CS majors have told similar answers that I will just go ahead and find ten (10) followed by I will make a guess (which is same as binary search) and some have said to increase speed I will read the array by my two hands from two sides (same as left pointer and right pointer). This also shows we are equipped with algorithms-->better algorithms-->we just need to switch our imaginative powers.

I have debated data structures with non CS friends. I ask if I give you these things (data) how will you better arrange it or how can you arrange it in a way to access it fast. They have started from array going to dictionary (mostly these answers) and then when you explain binary tree for data then they say ohhh wow never thought about it.

In conclusion algorithm development is an in depth and energy consuming work of activating our imaginative powers/function. Lastly when I first learned about insertion sort my mind was --> wow; just because it activated my imaginative power that something is also possible in this way!!!

Discussion

pic
Editor guide
Collapse
pentacular profile image
pentacular

Of course, the correct answer is to ask, "Why do you want to find that number? What problem are you really trying to solve here?"

Collapse
alokozai profile image
Qaiss Alokozai Author

true! imagination plays key role in developing smart algorithms.