Programming and Whiteboarding, and Algorithms, oh my!
Understanding what algorithms are and how to survive an interview that involves them.
We’re not in Kansas anymore. Well, that same sentiment is how I feel making the jump from a medical career to one within programming anyway. When I began exploring this potential new career and how to eventually land a job, I made sure to research as much as possible. With each search, there was one thing in particular that kept popping up that seemed to strike fear into the hearts of many aspiring programmers, including my own — algorithms.
But maybe they don’t have to be so scary after all.
What is an algorithm?
An algorithm is defined as a process or set of rules to be followed in calculations or other problem-solving operations, especially by a computer.
Within programming, algorithms are powerful tools that are used to create all sorts of incredible things we use in our everyday lives. Consider how Google Maps provides you the best routes to get to your destination; they use a route finding algorithm. In order to recommend new products based on what you’ve already bought or rated, Amazon uses their item-based collaborative filtering algorithm. Then, who can forget facing off against computers in a game of Checkers or Chess where the computer can never lose? These games use a minimax search algorithm to search through a tree of all possible moves before winning and mocking your inferior human brain.
Ok, so maybe you’re reading all that and thinking, this doesn’t help make algorithms sound any less scary. But don’t worry, we’ll get there. You might not think it now, but by practicing your skills with algorithms, remembering a few helpful tips, you can conquer whatever future algorithmic problems you’ll face.
Installing a logic chip in your brain — or something like that.
The internet is a (mostly) wonderful place. There are tons of great resources that can help you develop your skills with algorithms.
Here are just a few websites to get you started:
- Khan Academy — explains algorithms, different types of algorithms, and some practice problems.
- GitHub Sagivo Rails Camp — a GitHub account from someone who has been through interviews and created sample problems solved in Ruby syntax to work through.
- HackerRank — another site similar to CoderByte. They also have an Interview Prep Kit that includes helpful tips and guidelines.
- GeeksforGeeks — examples of the top 10 most encountered algorithms and data structures with programming.
- SoloLearn — a great little on-the-go app to help you learn algorithms along with some programming basics of the language of your choice. Perfect for those work or school commutes.
These websites all have hours of practice examples to keep you busy, but there are also so many more. One of the best things you can do is take the time to set up a practice schedule that works for you. Whether that means doing one problem a day or a few problems throughout the week. Now onto facing some whiteboarding.
It’s as easy as 1, 2… what was the question again? (RTFQ²)
So you’ve practiced your algorithms with all those different websites and now you’re getting serious about that whiteboarding prep and interview. This part might be a bit more nerve racking and you might want to jump to start writing code. But it is essential, when presented with any algorithmic problem to first breathe and then use these 7 easy steps:
- Read the question.
- Read the question. (No, I didn’t stutter.)
- Ask questions! (Make sure you thoroughly understand the question being asked of you. Is there anything vague about it? If so, it’s YOUR turn to ask a question(s) to make sure you’re giving your interviewer exactly what they want. This also helps show them you’re thinking things through.)
- Think out loud about your plan and explain your thought process. (Whiteboarding is more about seeing your problem-solving skills than your coding skills. They want to see how you work and usually, they can’t read your mind.)
- Write your pseudo-code. (This again helps show the logic you’re using to tackle the question asked of you)
- Begin writing your actual code. (You’re still talking out loud, right?)
- Consider any bugs and potentially refactor your code.
The best part about all of this is you can even begin practicing whiteboarding at home or at your school/office. Just grab a friend (or maybe a rubber duck — it’s not that weird) and start talking things through!
So there you have it! You now have some great resources and tips under your belt to begin developing that algorithmic side of your brain. I definitely encourage you to see what else you can find that helps you. Remember again though that consistency is key here. Consistency will be the best way to gain those skills you need to create or figure out any algorithm(oh, and nail that eventual interview).
What are some of your favorite ways to practice algorithms or whiteboarding? I’d love to hear about them!