[thedailybyte] Data Structures and Algorithms

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

Sets / HashSets

Problems To Solve

Linked Lists

Problems To Solve

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!

Problems To Solve

Searching

Problems To Solve

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

  1. 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!

  2. 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.

  3. 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

  1. 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.

  2. 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.

  3. 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

  1. 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.

  1. 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.
  1. 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.