Becoming a DS and Algorithms Pro: Strategies for Successful Review

One of my courses this semester is Algorithms. I’ve learned a lot and algorithms has changed the way I think about solving programming problems. In the world of iOS (or mobile engineering), it may feel it’s irrelevant. But the reality is that knowing data structures and algorithms is pretty much a requirement for software engineering job interviews, including mobile engineering.

Here I’ll be sharing some tips from my personal experience on how to effectively prepare and practice programming problems. I’ll also share resources that have been valuable for me. In future blog posts, I plan to go even deeper into some of these topics.

Yalla, let’s begin. 

Table of Contents

  1. Stick to One Programming Language

  2. Know Your Data Structures, Algorithms & Concepts

  3. Code by Hand

  4. Practice Programming Problems

  5. Trust the Process

  6. Resources

Stick to One Programming Language

During a coding interview, you’re expected to know your programming language really well. Whether it’s iterations, creating data structures from scratch, parsing a string, performing mathematical operations, and more. 

Hence, it’s crucial to choose one programming language you’re very comfortable with. For example, Python is known for its elegance and simplicity as a programming language, particularly during coding interviews. But if it’s not your go-to programming language then it’s not worth learning Python for the sake of solving programming problems. Remember that coding interviews are a high-pressure environment, so reducing the pressure of learning a new programming language will go a long way. 

Sam from Byte by Byte dives even further into this topic. Check him out here.

Know Your Data Structures, Algorithms & Concepts

What does it mean to know data structures, algorithms, and concepts? It would mean the following:

  • Being comfortable with implementing them from scratch. 

  • Understanding them conceptually and the problem they’re solving. 

  • Know their time and space complexities. Especially insertion, update, removal, and search operations in data structures.

According to Cracking the Coding Interview by Gayle McDowell, the following data structures, algorithms, and concepts are a must to know:

  • Data Structures

    • Linked Lists

    • Trees

    • Tries

    • Graphs

    • Stacks

    • Queues

    • Heaps

    • Arrays

    • Hash Tables

  • Algorithms

    • Breadth-First Search (Branch & Bound)

    • Depth-First Search (Backtracking)

    • Binary Search

    • Merge Sort

    • Quick Sort

  • Concepts 

    • Recursion

    • Dynamic Programming

I would add for Trees, make sure you’re familiar with Binary Search Trees and at least one self-balancing tree (such as AVL, 2-3 tree, Red-Black tree, etc). For Graphs, it’s important to understand Adjacency Lists and Adjacency Matrices. 

My suggestion would be to start studying data structures first, then transition to concepts and algorithms. Start studying a single data structure individually, implement it, then put it into practice by solving programming problems with them. Repeat those steps while studying concepts and algorithms. My go-to reference for studying these concepts is Data Structures & Algorithms in Swift coupled with LeetCode to solve DS/Algo-specific problems. 

Code by Hand

During a coding interview, you’re expected to know the previously listed data structures, algorithms, and concepts like the palm of your hand. One technique that’s helped me is coding by hand with spaced repetition. Coding by hand?! Yep, you heard right. Even Gayle McDowell mentions this very thing and reemphasizes this point because it’s a great way to retain data structures and algorithms. Here are some benefits of writing your code by hand:

  • Confidence - you won’t be intimidated by any programming problem that comes your way because you’ll know which DS/algorithm can help you solve the problem.

  • More time spent on solving programming problems - because you’re not hung up about how to implement a specific algorithm or DS, you can spend time brainstorming a solution for the programming problem. This will save you time! Especially if a programming problem simply needs something like a Quick Sort algorithm to solve it.

  • Programming like a boss - you’re less likely to make common programming mistakes because of your accumulated time coding by hand. You’ll be surprised how quickly you can go from figuring out a high-level solution for a coding problem to implementing the solution in a matter of a few minutes. 

Now that I’ve explained its benefits, here’s a breakdown of coding by hand with spaced repetition:

  1. Implement the specific data structure/algorithm using pen and paper or use a Text editor without syntax highlighting.

  2. Review your mistakes and re-implement them.

  3. Repeat steps 1-2 the next day.

  4. Repeat steps 1-2 the day after.

  5. Repeat steps 1-2 three days after.

  6. Repeat steps 1-2 every week.

For steps 3-6, it’s up to you how you’d like to use spaced repetition. I’ve reached a point where over 2 weeks, I implement one DS or algorithm a day. Once I’ve completed implementing all of them over 2 weeks, then I simply repeat the rotation. Again, do what works best for you. Practice, persistence, and repetition are key!

Practice Programming Problems

Now that you’ve gotten to a point where you know DS, algorithms, and concepts very well, time to put that knowledge to practice with interview-type programming problems! 

There are two sources I’d recommend for practicing interview-type programming problems:

LeetCode

LeetCode is a great resource for practicing coding problems. But where to start? That depends on where you are on your journey. If you’re open to any difficulty level, check out the Top Interview Questions list. If you’re new to coding problems or it’s been a while, start with solving Easy problems. Then work your way up to Medium and Hard to get your confidence going. LeetCode also allows you to filter by specific problem topics such as Linked List, Binary Search, and many more topics!

Pramp

Pramp is an amazing resource, allowing you to practice coding interviews with a live person - and for free! The beauty of Pramp is that it replicates the environment of an actual coding interview by communicating with an actual interviewer while solving a problem. You also have to swap roles and become an interviewer, which helps you build your mentorship skills and perform even better during your coding interviews. It’s a great way to prepare you for coding interviews - I can’t tell you how much constructive feedback I’ve received that has helped me improve dramatically! 

Trust the Process

Last but not least, it’s important to trust the process of studying DS and algorithms. You’re going to struggle at first. You’ll have challenges along the way. Self-doubt may occasionally creep up. 

That’s okay and embrace it. Know that struggling is a part of self-improvement to become a better version of yourself. It means you’re learning, challenging yourself, and growing. As long as you’re consistent, persistent, and putting in the work then it’s just a matter of time and patience until you succeed. 

I’ll leave you with this inspirational quote:

“Your doubts are not a reflection of your abilities. They are merely a sign that you are pushing yourself to be better. Keep going, trust the process, and believe in your potential.”

Resources

For any comments and questions on this post, follow up on Twitter.

Make sure to share this article. Appreciate you reading through my blog and until next time.

Buy Me A Coffee
Previous
Previous

Solve the Min Stack Puzzle

Next
Next

Solving Spiral Matrix Problem