Welcome to Data Structures and Algorithms
print("welcome")
In this course we will cover how each data structure works, when to use them, and their respective implementations.
We will touch on popular algorithms and algorithm techniques and solve a variety of popular DSA questions. By the end of this course you should hopefully be comfortable enough to solve problems on platforms like leetcode, hackerrank, etc. and you should hopefully feel confident in your understanding of time and space complexity.
Before We Get Started
There is only one prerequisite to this course. You need to know a programming language!
Don’t worry about what language the course is going to be in because I’m going to try and make it as language agnostic as possible (meaning you should be able to understand no matter what language you learn).
All you need to focus on is learning are the basics!
In Depth Resources For Learning A Programming Language
Refresher Resources To Brush Up On A Programming Language
Hash Tables / Hash Maps
How commonly do Hash Table / Hash Map questions get asked during a technical interview? - Very Frequently
Hash Tables | Hash Maps are pretty much guaranteed to come up in a technical interview one way or another. They are a very efficient data structure that we use when we need to associate data.
Hash Tables are sometimes referred to as “Dictionaries” (in python) because they function similarly to dictionaries where in a dictionary you look up the definition associated with a word, in a hash map we can lookup values associated with keys. These keys and values can be any of the primitive types and we can define what goes in our hash map.
Problems To Solve
- (Problem : Hash Tables : Single Number) Note - Use a hashmap to implement the solution to this problem. Don’t worry about the bit manipulation / math.
- (Problem : Hash Tables : Ransom Note)
Sets / HashSets
Problems To Solve
Linked Lists
Problems To Solve
- (Problem : Print the Elements of a Linked List)
- (Problem : Insert a Node at the Tail of a Linked List)
- (Problem : Insert a Node at the Head of a Linked List)
Stacks & Queues
A Stack is a LIFO data structure (LIFO - Last In First Out)
A stack is basically a stack lol
Imagine you’re stacking pancakes. The last pancake you put on the stack will be the first one you grab to eat. It’s not much more difficult than that.
Stack Example
pancakes = ['pancake 1', 'pancake 2', 'pancake 3'] # finished cooking pancake 4
pancakes.push('pancake 4') # adds pancake 4 to the end
pancakes.pop() # removes pancake 4 from the end
print(pancakes) # [‘pancake 1’, ‘pancake 2’, ‘pancake 3’]
Problems To Solve
A Queue is a FIFO data structure (FIFO - First In First Out).
If we were building some kind of drive thru software that tracked customer orders, we might use a queue because a drive through typically functions as a line.
drive_through = ['red car', 'blue car', 'yellow car'] # green car pulls up to drive thru
drive_through.enqueue('green car') # removes red car from front
drive_through.dequeue() # removes red car from front
print(drive_through) # [‘blue car’, ‘yellow car’, ‘green car’]
Trees
How commonly do Tree questions get asked during a technical interview? - Frequently
Tree Traversals are important to understand. When dealing with Binary Trees & specifically Binary Search Trees, you should be familiar and comfortable with these three traversals (preorder traversal, inorder traversal, and postorder traversal). Preorder, inorder, and postorder refers to the order we traverse the root node.
In a preorder traversal, we traverse the root node first (preorder = root first) and then proceed to traverse the left and right subtrees. Preorder -> (root, left, right)
In an inorder traversal, we traverse the root node second (inorder = root second) . We traverse the left subtree, then the root node, then the right subtree. Inorder -> (left, root, right)
In a postorder traversal, we traverse the root node last (postorder = root last) . We traverse the left subtree, then the right subtree, and then the root node. Postorder -> (left, right, root)
Try these traversals yourself!
- (Problem : Tree: Preorder Traversal)
- (Problem : Tree: Inorder Traversal)
- (Problem : Tree: Postorder Traversal)
Problems To Solve
Searching
Problems To Solve
- (Problem : Search In Rotated Sorted Array)
- (Problem : Search In A 2D Matrix)
- (Problem : Find minimum in a rotated sorted array)
How To Get An Interview
There is a standard way to apply to jobs and then there is my way .
I don’t know anyone else who is using the same application strategy as me, but this is the way I have been applying to opportunities for over two years and I never struggle to get an abundance of interviews. Everyone else who I’ve recommended this strategy to has also seen great results.
Get your resume templates from this website.
During The Interview
After interviewing at hundreds of companies and after doing public speaking for so long I’ve become very comfortable with my communication skills. These are some of my “During The Interview Tips”
Coding Tips
-
Get into the habit of approaching all problems in a similar way. Have a routine for yourself that you can use to tackle each problem. Almost like an algorithm for algorithms!
-
Make sure you understand the problem. Run through multiple test cases and verify with your interviewer that you understand why each test case produces it’s corresponding result.
-
Plan your approach. Spend a few minutes coming up with your algorithm. Use comments to sketch out step by step what you’re going to do and ask your interviewer whether you should pursue the approach you came up with.
Getting The Interviewer To Like You
-
Try to match the energy of the interviewer. If they seem to have a very serious attitude regarding the interview process then you should retain a very serious attitude as well. If they’re more relaxed and seem to not care as much, then you should try and match that energy and remain more relaxed and calm.
-
Try to ask a question before the coding portion if possible. Act as if you’re actually interested in the answer and ask something that may allow you to connect to the interviewer on a personal level. Having things in common is how all relationships are built so look for that commonality.
-
At the end of the interview make sure to ask another question or two to show that you’re interested in passing the interview. If your interviewer notices you’re passionate about the job then they might be more willing to pass you.
Where To Go From Here
Congrats on making it through all of the material!
If you’re interested in learning more then just hold tight. New content will be added to this course over time that your current membership will give you access to including problem solving videos and more relevant topics.
In the meantime I’m going to recommend some more resources you to continue your algorithms and data structures journey.
Resources for continued learning
- First and foremost I’d like to mention the platform that is hosting this course, The Daily Byte.
The Daily Byte is a great resource for you guys to start solving problems every day working up from the fundamental material you just learned to solving advanced problems over time. Work through a single problem each day, delivered to your inbox, in an order that encourages learning as opposed to rote memorization.
- Secondly I’d like to talk about coding interview prep platforms. There are several great platforms with an abundance of perfect algorithms and data structures questions that you can solve to practice and improve your skills.
- Lastly I’d like to mention mock interviews. Towards the end of your studies when you’re closing in on your actual interview date you should get comfortable speaking to others. You can mock interview with friends, fellow classmates, co workers, other people studying for interviews, and even working professionals at FAANG!
There are many mock interview services out there (some free and some paid) that you can use to practice your social skills, timing, and pressure management.