DEV Community

Justin Bermudez
Justin Bermudez

Posted on

Get Started Learning Data Structures & Algorithms

First getting into Data Structures and Algorithms can be pretty intimidating especially when you do not know where to start. I hope this little blog can move you to the right direction. This blog WILL NOT go into every part of data structures and how to implement them.

Choose Your Language

The obvious first thing to do is choose what language you want to learn in. Does it matter? Kind of...

If you are going for a "Java Developer" role, you better roll up with Java. It might be awkward if you ask to do it in another language. Although if you are going for "software engineer" role that does not have a language in its name, then you are usually in the clear to choose any language you are comfortable with.

In my opinion you should prepare one of the more popular languages like Python, C++, Java, Javascript.

Note

Most the time the job description will say what they would LIKE you to have. If your language is in there you may get extra brownie points.

Language Proficiency

Once you have chosen your language, you should become really comfortable with it. Understanding array, object/hash, string, and number manipulation will make things a little bit easier to approach and understand algorithm and data structures.

Big O Notation

One my favorite topics is space and time complexity which we denote by big O. This is the runtime and the amount of space a piece of code takes. If you did not take a data structures course in college, then the best time to learn about Big O is alongside learning data structures and algorithms. It will be easier to learn the runtime and how much space something takes once you learn how to implement it.

One the reasons you have to learn this is for efficiency. During interviews you may be asked if there is a faster or more efficient way to solve a problem. It is also good to just understand how fast your piece of code is.

Algorithms

There are a lot of algorithms and there are also many ways to implement each one of them. What you are trying to learn is how they work. Some examples of algorithms you should take a look at are Quick Sort, Binary Search, Merge Sort.
Algorithms like these do not require any data structures so they are good to learn first.

Linked List

This is a heavy one to learn and can take awhile to master. This is a collection of data called nodes that point to one another, and connected linearly. Each node contains the data and the reference to the next node in the list.
Understanding how to traverse a linked list to retrieve data will be one of your main purposes of this data structure.

Stack and Queues

The most important concepts to remember for these are push, pop, fifo, and lifo.
Fifo - First in, first out
Lifo - Last in, first out

Fifo would be for a queue while a lifo is for a stack. Think of a Line which is basically a queue. The person at the front of the line gets to enter the party first, then the next person, etc.
Stack would be exactly like a stack of plates. When you are taking a plate off, you take the last one you placed on the stack.

Binary Trees

This looks like an upside down tree. Each node will have up to 2 child nodes. Understand that the left child will always be smaller than the parent, but the right child will always be greater than the parent.
There may not be many times where you have to construct a BTree yourself but just remember the value of each child is smaller or greater.
You should be comfortable traversing through a tree to be able to solve a problem.

Graphs

There are a few prominent graph algorithms which are Depth First Search and Breadth First Search. These are algorithms to traverse binary trees and search for an input.
Depth First Search(DFS) goes deep into a branch before looking into its sibling branches.
Breadth First Search(BFS) looks at each child node, then goes into one child node to look at its children.

Top comments (0)