# Basic data structures you need for coding interviews

Updated: Jan 17

Hey y'all ! (I'm trying to go the Texan way after it came up in a discussion today with a teammate who's from there :) )

I want to list basic types of Data Structure that you need to know of before you think you are ready for an interview. And I'll share one very easy leetcode problem against each one to test your basic knowledge!

(After this, do read the __next post__ on Advanced data structures !)

1. **Arrays**

*What should you practice? *Being able to navigate in any sort of manner in an array using a loop. Being able to do the same in a 2D array. Try doing this - __https://leetcode.com/problems/spiral-matrix/__ If you can't do this, you aren't ready at all. No pressure.

2. **Strings**

*What should you practice? *Being able to slice and dice the string, and navigate through it. Try doing this - __https://leetcode.com/problems/split-a-string-in-balanced-strings/__

3. **Linked List**

*What should you practice? *Being able to traverse, insert, play around with pointers. (Java lovers, please remember using an inbuilt data structure DOES NOT COUNT! ) Take a shot at this one - __https://leetcode.com/problems/merge-in-between-linked-lists/__

4. **Trees**

*What should you practice?* Oh there are so many things here. But let us focus on traversing the tree. So priority should be pre/post/in order traversals. Also, how do you run Breadth First Search (BFS) or Depth First Search (DFS) on a tree? Test your skills here - __https://leetcode.com/problems/symmetric-tree/__

A specialized problem set here would be related to Binary Search Trees. Probably try the following - __https://leetcode.com/problems/range-sum-of-bst/__

5. **Graphs**

*What should you practice?* Being able to do a BFS or DFS on a graph. And figuring out how to store a graph (there are multiple ways). To practice - Write a program to run BFS and DFS *recursively*.

6. **Queues/Stacks**

*What should you practice?* They are similar but yet so different. Probably the previous question already got you thinking about these (iterative BFS/DFS). But if not practice the following for a good start - __https://leetcode.com/problems/implement-queue-using-stacks__

7. **Dictionary/HashMap/HashTable/HashSet**

*What should you practice?* You should practice knowing when NOT to use these :) I've seen people use these in every question, assuming they are the universal solution. But that's not the case. These cost extra memory! They try to get you O(1) time, but do you know how? Because if you use this in an interview, I'll check if you know how they implement themselves. So be careful. Take a look at the following - __https://leetcode.com/problems/happy-number/__

Let me know what you thought of those problems! I was sneaky and put a few algorithms in there, too :) But hey, it is all for a good cause.

Peace out.