Black Friday Sale - 50% off Go Courses!
I am able to provide free resources like this and Gophercises by selling premium Go courses. If you have found any of my free resources helpful, please consider checking out the premium courses. They are both 50% off until Dec 2nd, you'll learn an incredible amount of Go in the process, and it helps me continue to provide free resources like this.
→ Web Development with Go
→ Test with Go
Both courses have lifetime access, a 30-day money back guarantee, and free updates.
Thank you for your continued support and happy coding!
Jon Calhoun
See https://play.golang.org/p/u4E6mrios0 for the completed code from this video. In this video we learn how to represent a binary tree in Go code. Once we have the basic structure in place, we then go a step further and define an input file format that we can use to read in arbitrary binary trees moving forward to test our algorithms with. This post is part of the Let's Learn Algorithms series where we learn how algorithms work, see how to implement them, and then spend some time working on practice problems to reinforce how the implementation details work, as well as to help you learn to recognize problems that could be solved using any particular algorithm.
In this video we cover how the depth first search algorithm works. We do so by starting with a binary tree and walking through how the algorithm would iterate over the tree searching for a specific node. We intentionally start with a tree because this removes a lot of complicating factors that might be present in other graphs, such as running into a cycle, but everything you learn here will be applicable to when we start working with cyclical graphs to also run our DFS.
In this video we discuss a specific type of graph - the binary tree. In the video we discuss some of the properties of a tree that make is a special type of graph, and then we discuss a few common properties of trees that aren’t always present, but are often there in order to make trees a more optimal data structure to work with. This is all used to set the stage for upcoming videos where we start to implement some algorithms first using trees, and then later on more general graphs.
Jon Calhoun is a full stack web developer who teaches about Go, web development, algorithms, and anything programming. If you haven't already, you should totally check out his Go courses.
Previously, Jon worked at several statups including co-founding EasyPost, a shipping API used by several fortune 500 companies. Prior to that Jon worked at Google, competed at world finals in programming competitions, and has been programming since he was a child.
©2024 Jonathan Calhoun. All rights reserved.