Understand each data structure with a real-world example

There are some common data structures used frequently for various applications and hence it becomes important to study them well. This is also a reason why coding interviews focus so much on them. Data structures are the core of your application because they control how efficient your application is. Making a bad choice there is very costly and hence we will see appropriate usage of each data structure with one common theme across the post. … More Understand each data structure with a real-world example

Intuitively Choose the Right Data Structure

An important thing to note is that in an interview when you are solving a problem, you almost always choose a data structure for its strength. In other words, you don’t usually choose a data structure just because it has fewer weaknesses and has a good average-case performance. For example, if you want to find a maximum number frequently, priority queue/heap is most likely the best choice. If you want to store some value associated with a key, a hashmap is likely the best choice. … More Intuitively Choose the Right Data Structure

Key to Solving Every Problem in a Coding Interview – Choose the right tool

In a way, this post is a summary of your data structures analysis class. There are mainly 7-8 data structures that are very common in the coding interviews. In reality, there can be an infinite number of data structures because data structures are just a way to store the data and you can create your own ways of storing data. From the point of view of the coding interview, you are going to get tested on standard data structures and hence you should focus on them. Although I will discuss each data structure in detail in separate posts, you can use this post as a time & space complexity cheatsheet, or as a checklist of different data-structures to study for your interview. … More Key to Solving Every Problem in a Coding Interview – Choose the right tool

Dynamic Programming

The idea behind solving dynamic programming problems is simple – remember what you have already solved and use the already computed solution in case you are solving the same problem again. In other words, solve one problem only once and remember the solution to it so that you can quickly provide the solution without the need to solve the problem again. … More Dynamic Programming

Backtracking

Recursion makes exploration of all paths/branches of the tree very easy. At any time you only have to think about the current level and recursively call the function for exploring the children. Whenever you have a recursive code, you should always think about the base case where you will terminate the recursion. Depending on the problem it would, of course, differ. For the above example, the terminating condition can be “Is the current node the key?” … More Backtracking

Recursion

Formally, as you might already know, recursion is a process when a function calls itself directly or indirectly. When a function calls another function, we can easily imagine the execution going into the other function and coming back to the calling function once the called function is executed completely. It’s a “visual” process. … More Recursion

Analysis of Algorithms | Big-O Analysis

For any problem, usually, there are multiple ways to tackle it. Solving a coding problem in an interview is no different. There are almost always multiple solutions to the given problem. Each solution has some cost i.e. time and space complexity associated with it. Your job is to identify various solutions, analyze their time & space complexities, discuss this with the interviewer, and implement the most suitable solution depending on the inputs and constraints. … More Analysis of Algorithms | Big-O Analysis