VOILA!Life Is A Song!!(Part One)
The very first lab session of my engineering studies ,anything of any practical purpose anyway, was the Data Structures lab.(DS..Data in Structured arrangement..or so I think..)and it blew my fuse ..big time!!..
In the 4 years of engg studies,the 1st year is spent learning things you want to forget the moment you are done with the exams.So it’s the 2nd year ,or the 3rd semester that life begins for the engineer..and my life was to turn the IT way..and all that I knew about IT was the mallu word for it,thanx to seniors who made sure we knew..and how….’vivara saankethika vidhya’..whew!
The theory sessions came first.The (guest)lecturer for D.S was a very tiny lady,much resembling a rabbit in face and demeanour.She sang to us endlessly about ..I don’t know..I never heard a word anyway..most of our ‘teachers’ at the time were scarcely that.They were fresh B.Tech pass-outs who wanted to kill time ..We learned about lovely names like D.S,D.B.M.S,and O.O.P.S..that last one was my favourite..OOPS stood for object oriented programming,and the S just tagged along like an initial. Coming back to data structures ,now it is a wonderful subject. One of the most important bricks that were to constitute the foundation of our IT knowledge .Once the initial confusion got over and I accepted that the teaching medium was indeed English and not French (Greek or Latin)as it had appeared initially ,I realized ,one fine day, that the rabbit and my more intelligent classmates were wading through a specific type of quicksand called, algorithms .of course, I knew algorithms ..they were a method of writing down the problem at hand, breaking it up into sub-tasks until it cannot be divided up any more. at that point,all your teeny –weeny tasks can be done in one go… sort of ,you had now beaten the living daylights out of the problem ,and its no more a problem for you.I knew that’s what algos were about.. and I liked it too ,I mean, it’s a cool idea ,init ?They taught this in standard 8th ,I think ,along with some other basics like ,BASIC itself. .my cobweb of a memory tells me ,those days basic used to mean, beginners all purpose symbolic instruction code.. or was it symbiotic now….?
So on that day of my first DS enlightenment, came my way the first problem ,with a capital p so it was a Problem. As is common knowledge ,you start learning English words with ‘A for apple’.. if its a new programming language, you start it with the ‘hello world ’ program.. much the same way ,a course in algos always start with the ’add two numbers’ problem.It struck me immediately ,algorithms start with the ‘start’ and end with the ‘stop’..but whatever went in between remained unknown.. .people around me had started writing ,and I resigned to thinking, and thought and thought ..and then, I came up with a stunner !My first algo in college..
ADD TWO NUMBERS
Lol!! And to think it looked perfectly sane at the time.. !!There I sat with my prize winner ..
But that was the beginning of the end of ignorance, total and complete. .the ignorance ,not the dispelling…By the time I started feeling comfortable around anything algo,we were into stacks and queues.Now stacks everyone knows…a neat stack of books arranged one on top of the other.. ha, everyone knew stacks. .so I gave my ear drums a rest!After a few weeks of theory, when we were just ripe enough to start our labs, they introduced us to the ‘internet’ lab.. where we were to do our DS labs.. Now, row upon row of silent and completely blank faces(computer monitors)is enough to scare someone on a first visit ,but being given a comp terminal all to yourself! Did they want us to handle this machine all alone? Nothing like it would just jump out of its pedestal and run away, but one never knew ..and all the comps were loaded with Linux.. not even the omnipresent Windows ,ya that really helped ..now I was a complete martian landed on pluto..life’s a song,enjoy!
The first lab question to be tackled read like this:-
‘Implement stack using arrays’
A stack of arrays ??Now if they had given a pile of books or something, I could have given that a try.. I could have done up a neat stack ..of books…but arrays.. really? Can u reread that question for me?? And my neighbour read it out to me.. no luck ,the ‘arrays’ stubbornly remained arrays. .hell!
Now, I had carried my note book to the lab, something is better than nothing, especially when you went to a lab ,..for the first time..it struck me then, the algo for this problem was done in the theory class…voila!there was an algo for this! Now, you just had to put it into formal/business like tones.. ya,just do it using the programming language..and life suddenly became a song…
All self respecting stacks in the DS world are expected to do two things,in the least..push and pop..no ,not plop..like onto the floor..its pop..The push thing went fine,you know everybody knows push..but the pop thing got me.It was something new ,and all things new were scaring me that day..pop..pop..see,pop is where the topmost thing on your stack is removed from the stack..On real stacks ,tht would have been easy…but on a DS stack…I mean,there wasn’t even a real stack..the stack was only in your imagination..and people wanted to put things in it..and whats more,they wanted to take out things they had(never)put in..talk about going nuts…
Ya so,when you do a pop,the topmost thingie has to go away..but where is ‘away’ inside the comp..the recycle bin..?or does it just jump outside of the comp itself??Noway I could have made it do that.. I mean,I just was not smart enough for that..Maybe,I could print it out..I eyed the old dot matrix printer ,probably the very first one to be acquired by the department..Cuckoos had started singing in my brain,and I forgot all shame and stammered my question to rabbit..’ma’am,when you do a pop,where does the topmost element go?’She looked confused..I explained,’like.. ma’am ,when you do a pop,where does the topmost element go?’She brightened up at that.’just delete it’.wow!of course!why didn’t I think of it before…delete…I know delete,there is even a key on the keyboard for it DEL..wow,that’s soo easy..’thank you ma’am,for dispelling this cloud of confusion that was eating me up’..that would have scared her away..so I kept my thanks to myself..and beamed at her,she beamed back,all was well..nothing to worry..cool..life was a song..
But there was something wrong with
Close to pulling off my hairs now,I decided to ask again..’ma’am,I don’t know how to delete the topmost…’blah blah..’just write the function and call it’…function..ah yes..I knew functions..but writing a function with just the name delete,and nothing else inside it ,and then calling it when I needed to delete,..will that work?How will delete() know what I wanted done..?mind reading??’ma’am…(me totally flustered now)but what to write inside that function??I mean where does the element go when it is deleted..?what happens then??’Now ..she gave me an even bigger smile..I guess finally she was sure I was an ignorant fool and not trying to show off with annoying questions..’just replace the element with zero and update your flag..’; enlightenment!! light!!!....at the end of the tunnel!!thank you …for that piece of wisdom..now I will rest in peace in my grave…thank you..life was a song..again..
'rabbit' is a term of endearment in the writer's dictionary.