Don't worry, you aren't alone! Not everyone will admit it, but many developers feel exactly what you are feeling when they get started with coding, algorithms, and more.
Whether you are a CS student at university, self-learning at home, or something in between, the scenario is nearly always the same. First you start to learn the algorithm, and at a high level it all seems to make sense. You can even walk through the algorithm on paper, showing what steps should be taken and how the state changes as the algorithm is used. And then when you sit down to code it everything seems to fall apart...
And the list goes on and on and on...
Rather than running into a single problem that you can work out, what typically happens is you get overwhelmed with smaller challenges. You need to figure out how to do all these litle details right, and without every single one being implemented correctly, your code will never work.
But don't worry! This doesn't mean you aren't smart enough, or math-oriented enough, or anything else like that. It simply means you need some practice and guidance.
I'm going to let you in a little secret - learning to code algorithms has more to do with how you are taught than with the actual material.
Take me for example. If you were to give me a big ol' math proof for an algorithm, I wouldn't know where to start. There was a time long ago that I might have puzzled it out, but I haven't looked at math like that in forever. I would simply be lost.
On the other hand, if you had someone explain how the algorithm worked without getting caught up in fancy terminology and instead focusing on what is actually happening and why, I'd probably start to get it.
Everyone learns in a different way, but there are a few common approaches that I have found always help people comprehend algorithms more successfully:
In this course I am going to use all four techniques described above to help you learn how algorithms work, how to code them, and more importantly, we will learn how to take any abstract idea and quickly translate it into code.
By the end of this course you might not have a CS degree, but you will probably understand core computer science algorithms, data structures, and more as well as a college graduate. And we are going to do it through lots of coding.
You will watch me explain then code an algorithm. You will code the algorithms yourself. And for the later problems you will even find additional practice problems that you can try on your own then watch me solve them (in case you get stuck 😉).
While you may not use every algorithm you learn here directly, you will use the knowledge you gain taking this course. For instance, your ability to take an idea you are discussing with peers and translate it into code will improve, your ability to tackle silly interview questions will improve, and you will have a better understanding for how the algorithms you are using might impact your code's performance.
But even if all those things weren't true, algorithms are a ton of fun when approached in the right way!
Algorithms with Go is living course. That means I will continue adding new modules (collections of videos covering related topics) to the course every so often. Exactly how often new conten will be added will depend on how much free time I have 😁
Module 01 is available now and focuses on getting a feel for how the course will go. We will look at a few straight forward problems, code solutions to them, and then run tests to make sure we completed them correctly.
As we progress into the later problems in this module we will learn a few algorithms - like the Euclidean algorithm - but even then we will limit each algorithm to one or two implementations.
Below is a listing of all the video lessons currently in this module.
2. What is an Algorithm?
3. How to improve
4. How to use the course materials
5. Find a number in a list of numbers
6. Sum a list of numbers
7. Reverse a string
8. The classic FizzBuzz problem
9. Convert a decimal to any base (2-16)
10. Convert a number in any base (2-16) to a decimal
11. Convert a number from any base to any other base (2-16)
12. Find two numbers in a list that sum to a given amount
13. Factor a number (primes provided)
14. Fibonacci numbers
15. Greatest common divisor (GCD)
16. stdin and stdout
Module 02 isn't available yet, but I am working on it now and hope to release it soon.
In this module we start to explore some of the sorting algorithms that exist. We will also start to examine how to do things like reverse a sorting order, recursion, divide and conquer, and we will briefly talk about Big O. If none of that makes sense to you, don't worry! We cover it all in the videos.
Below is a listing of all the video lessons currently planned for this module. When you see the
[algo] tag this means the video will focus on explaining the algorithm, while videos tagged with
[code] will focus on implementing the algorithm with Go code.
1. Why sorting algorithms?
2. Bubble sort [algo]
3. Bubble sort [code]
4. Insertion sort [algo]
5. Insertion sort [code]
6. Binary search [algo]
7. Binary search [code]
8. Insertion sort with binary search [code]
10. Divide and conquer
11. Merge sort [algo]
12. Merge sort [code]
13. Merge sort with goroutines [code]
14. Quicksort [algo]
15. Quicksort [code]
16. Big O
17. Benchmarking some sorting algorithms [code]
18. Combining algorithms [code]
Module 03 isn't available yet, but I plan to work on it in the near future.
This module focuses on learning about some of the first data structures you will need to learn. The title calls them basic, but that is a relative term - they are basic compared to some of the more complex data structures we will look at in future modules. But that doesn't mean they are too complicated to understand!
Some examples of algorithms we may explore include: linked lists, doubly linked lists, stacks, queues, sets, binary trees, hash tables, priority queues (heaps), and maybe a few others.
Module 04 isn't available yet, but I plan to work on it in the near future.
This module focuses on learning about greedy algorithms. I don't expect it to be incredibly large, but I want to give students a sense of what greedy algorithms work and how they can code them. I also want to show how some things can seem greedy but really aren't to help you avoid those mistakes.
Module 05 isn't available yet, and likely will take a few months to be released.
Graphs are pretty neat because you can represent all sorts of real-world scenarios as a graph. For instance, you could use graph theory to map the route you take to work, or you could use it to solve those sliding block games in the minimum number of moves.
I have plans for ~10 modules diving into subjects like dynamic programming, advanced data structures (red-black trees, etc), more advanced graph theory, and more, but it is going to take some time to get there. If you want to help expedite the process, sales from my paid courses help me allocate more time for these courses. The more sales I make, the less time I have to spend doing paid work and the more time I can spend on these free courses!
Jon Calhoun is a full stack web developer who teaches about Go, web development, testing, algorithms, and anything else he finds interesting. He spoke at the GothamGo conference about focusing on simplicity when writing software and is a panelist on the Go Time podcast.
Previously, Jon founded EasyPost, a shipping API that many fortune 500 companies use to power their shipping infrastructure. Before that he worked at Google as a software engineer. Before that he studied computer science at UCF.
You can find more of Jon's work, including other FREE courses and tutorials he has created, below.Follow @joncalhoun
Algorithms with Go was created by me - @joncalhoun
I am all for giving back to the community, but the Gophers used here are part of my course branding and I paid real money to have them designed. They are not publicly licensed, and I ask that you do not use them in other projects, websites, or anywhere else without first asking for my permission. Thanks!