If
you are a software engineer, you must have known some data structures
and some algorithms. If you are like me, you must be afraid of those
words.
Yes,
a lot of people (we would some times not even hesitate to say: all of
us - data structure champions, please ignore my blissful ignorance
and forgive me), hate those words. We kind of feel scared of the
whole concept of data structures and algorithms.
I
am a software engineer. And I had data structures, algorithms and
their analysis as a core part of my curriculum. I would not
lie, I was hardly able to understand most of it. It was all like
gibberish to me at that time.
I
have been writing software (or at least working in a software company
:P) for more than 10 years now and I still get goosebumps when I hear
those words. I knew something was not right and needed to be changed.
Hence I was always on the lookout of a way to make these things (now
my beloved) stick around my head. I searched internet, surfed
websites and blogs, listened to videos in search of a superhero trick
to understand data structures in a ninja style, just like Bruce Wayne
was searching for a way to fight injustice in Batman Begins :).
As
simply killing the offender does not mean justice, reading and
memorizing data structures and a few algorithms around these data
structures will not sail us across. We need to kill the real beast. A
deep understanding of basic data structures and algorithms and a way
to build our own data structures and algorithms using this base is
the ultimate goal. Lets see how far we can go.
Following
are the steps I came up with which I am trying to follow to move
towards our goal in the step by step manner. I believe, these steps
can make you potentially learn anything quickly and make it stick
forever. but for now, lets apply them to data structures and
algorithms.
Step 1: Start small and basic
Even the mighty Banyan Tree stars as a seed. :) |
- Start with the easiest, smallest and simplest data structure
- Understand the ins and outs of this easiest data structure and operations you can perform on this data structure.
- Try to avoid calling these operations algorithms if that word gives you nightmares :P
Step 2: ADT: Abstract Type Data...??? Nope, wait, I mean Attention To Detail..
Focus!! Focus!! Focus!! |
- Ridiculously focus on the details of this small data structure.
- Understand how it works, what are its key features. Live with the data structure day and night. Become desperate to understand it exactly as Bruce Wayne was desperate to fight criminals to the point that he locked himself up with the criminals to understand them.
- Understand the limitations of this data structure so that you have the reason to look for a better data structure if at all it exists( as of now you are not aware of anything else in the world).
Step 3: Theatricality and Deception are powerful agents...
Theatricality add the much needed spice to your learning! |
- Devise your own personal situations/tools/scenarios where you can apply this data structure in a most dramatic way you can think of
- Attach them to something really personal to you...
Step 4: In your own words...
- Write about the data structure in your own words.
- Create your own problem statement and your own solution
- Create a data structure workshop like the one Bruce Wayne had :) .
Step 5: Call Alfred often
- Have your own Alfred. Okay relax, you don't have to hire a butler. You actually don't even need an actual person.
- After writing down stuff in your own words, refer the original material and confirm that you have written everything correctly. That's it!
Step 6: Engage all your senses
- See the data structure in your mind's eye, picture it.
- Hear your own thoughts on the data structure, listen to videos if you wish.
Step 7: Be creative...DIY style...
- Create something of your own that uses this data structure. Even a hand sketch would help.
- Right a song about it, paint it, use them while cooking :D
- What did you say? how can I use a data structure while cooking? haha.. thats where your creativity will come in..
Step 8: Batman Vs Superman(Recall Vs Review)
- Recall your knowledge of this data structure periodically, with exponential time gaps
- Never review or reread the material unless you have tried recalling to the point of exhaustion.
- The idea behind this recall vs reread philosophy is that you want to store this stuff in the long term memory for retrieval when you actually need it. Not in the short term memory from where it will be removed by the brain's garbage collector on the first chance it gets.
Step 9: What about escalation?
In the end scene of Batman begins, James Gordon rightly warns batman about the tough criminal (The Joker) he is about to face just after defeating one. And Batman says calmly: "I will look into it". Batman indeed succeeds in taming the Joker, after a lot of tough fights, compromises and sacrifices.
Data structures are no different, just after you have the easy data structure under your belt, you will face the tough one, but if you keep the spirit like Batman, you would also succeed in taming all of them.
Step 10: Complexity is complex. Keep it out.
- Explore each data structure for its usefulness, use it and find out its limitations.
- Do not focus on the complexity at the beginning.
- Remember! For a learner everything is good. Learn it as a way of doing things-optional tool in your toolbox.
- You can only be sure about which tool is better by using it.
All I am trying to say here is that try to understand the pros and cons of a data structure or algorithm by your own experiments instead of getting this information from a book (at the beginning). At this point you are not really concerned about how the data structure or algorithm will behave for a million records. Always, Start small and go big incrementally.
So, Good bye Complexity, (Not) see you soon!! Until then, go in hibernation and enjoy your lone time :)
Step 11: The most important one!!
- Do something totally unrelated to data structures and algorithms.
- Anything thats not related to data structures will do. Even if you choose to learn a new programming language, thats fine.. but really? do you have nothing else in your life? :)
- Take some other goal form your list of goals (I surely hope you have more interesting goals too) and work on it, diverting your mind away from data structures and algorithms.
I hope these steps make sense to you and help you understand data structures and algorithms as they are helping me.
Do let me know your thoughts. All inputs are welcome and highly appreciated. :)
Next post onwards, we will start our journey through the Amazonian forest of data structures and algorithms, starting with the simplest and cutest of our friends....Caterpillar....yeah yeah I know you want to ask.....but hold your horses till the next post :)... hope you will enjoy it.
Until then,
Happy Learning!!!!
Banyan Bat.
interesting and intuitive approach to learning
ReplyDeleteThanks Sabya!!
DeleteGood start batman, never thought of learning DSA in such a fresh way :)
ReplyDeleteInnovative approach sir! I am probably sailing in the same ship and the word DSA still triggers fear somewhere deep inside me :) But this has motivated me to start afresh! More such articles expected Mr. Bat.
ReplyDeleteThanks guys!! I am also hoping to continue posting!! Your feedback would keep me going....
ReplyDeleteThe kind of information you want to supply with examples like Batman & Superman is "#SimplyGreat# way to put words in blog. Well Played Author and keep it going.
ReplyDelete