Use KATA to do Training on Basic Algorithms
952 words in 6 minutes
As we all known, technical questions count a great part in software engineering interviews. Although I have much project experience, I simply do not feel strong at it, owing to the fact that I am not a formal CSSE student. But anything can be grasped nowadays by self-learning. We have lots of resources on the Internet. Today I want to share with you a method I use for getting familiar with basic algorithms.
Breakdown
If the ability to use algorithms to solve a problem is a kind of skill, there should be a way to to practice it and make it our own. Just like what we do to learn how to play a instrument or to improve athletic performance. This is where I start.
I started by research on learning methods1. Do you ever think of that learning itself is actually worth learning? It is. In fact, there are tons of ways to help one master a skill. KATA2 is one of them.
Today I am going to show you what is KATA and explain my own KATA scheme on basic algorithms implementation.
What is KATA?
The first time I heard of KATA was in a post named “Improving Skills by Kata”3. KATA is a Japanese word describing detailed choreographed patterns of movements practiced either solo or in pairs. The basic philosophy of KATA is to practice the skill repeatedly to gain muscle memory. The writer learned Ruby basics by setting himself a goal: building a TicTacToe game in less than an hour. Then he did it again and again until he can accomplish this goal easily.
Why use KATA?
KATA is actually a way to do deliberate practice. It is great for solo training because it does not require any supervisory from others. We can easily build a scheme on our own. The only things we need to do are practice, practice and practice.
How to use it?
The way I make use of KATA is almost the same as that writer. First, I choose several basic algorithms like BFS, DFS, merge sort, quick sort, binary search, tree traversal and etc. Then I start to implement them one by one and set up testing environment. I also set a goal for each of them, say for merge sort, my goals are to finish it within 4 minutes and write perfect code for 10 times in a row. Once I get prepared, I can go ahead and do the coding day by day. Another important thing is to keep a log. An basic log should be a record of results. For example, this time I implemented a merge sort in 03m56s correctly. To make it simple, we may use a table with 3 columns: file name, correctness and time.
Result
I absolutely benefited a lot from my KATA scheme(otherwise I would not share it with you). At the very beginning I was not able to implement any of basic algorithms I chose. The first time I struggled to do merge sort in more than 20 minutes. Now I can my best record for merge sort is 3 minutes 16 seconds. See? KATA is absolutely efficient and useful.
Weakness
KATA is great but not perfect. It is good for gaining muscle memory. I do not even need to think about the actual code when I practice because it is already there in my mind and my hands. But I have to remind you that it would be much better if you understand the algorithm fully. If you do it every day, you probably will not need to care about that. But if you stop for some time, you will not remember a thing and lose your head. So it is more important to remember the structure of the algorithm, reason every detail in code and generate your own comprehension. That will make you even more powerful.
Looking for Partner
I am doing my second round KATA on algorithms training now and am looking for someone or some guys who are interested to join me. This time I would include more common algorithms. It will not cost more than 30 minutes per day after you grasp the basic ideas and set up your own training environment. And you definitely will be deep impressed by how KATA reform your confidence on technical questions.
Here is a KATA repository of my Github account. Feel free to check it out or contact with me.