DEV Community

Cover image for Go: Learning Journey Through Algorithms
Asher Buk
Asher Buk

Posted on • Edited on

Go: Learning Journey Through Algorithms

I've been working with Node.js and its ecosystem. Now I'm diving deep into Go and I'm getting huge enjoyment from its approach β€” on one hand, simplicity and no syntactic sugar (you can get diabetes from all the sugar in JS, it's too sweetπŸ™ƒ), on the other hand, incredible capabilities and a greater sense of being "close to hardware."

I decided to document my learning notes in an open repo dsa-golang β€” specifically, implementations of classic algorithms in Go. This isn't production code, but educational examples with comments and Big O complexity analysis.

Sure, there are hundreds of similar repos... so what's the value in opening another one? πŸ‘‡

  • Classic solutions to classic CS problems, without over-engineering or language-specific optimizations, for clear understanding of the algorithm.

  • Meaningful semantic naming

  • Aiming for simple and idiomatic Go code

  • Breakdowns and diagrams right in the comments

What's included:

algorithms/
β”œβ”€β”€ search/
β”‚   β”œβ”€β”€ Binary
β”‚   β”œβ”€β”€ Linear
β”‚   β”œβ”€β”€ Jump
β”‚   β”œβ”€β”€ BFS Filesystem Β· BFS Graph Queue
β”‚   └── DFS Filesystem Β· DFS Graph Recursive Β· DFS Graph Stack
β”œβ”€β”€ selection/
β”‚   └── Quickselect
└── sort/
    β”œβ”€β”€ Bubble
    β”œβ”€β”€ Selection
    β”œβ”€β”€ Insertion
    β”œβ”€β”€ Merge
    β”œβ”€β”€ Quick
    β”œβ”€β”€ Quick In-Place
    └── Heap

datastructures/
└── graph/
    └── Adjacency List

leetcode/
β”œβ”€β”€ Two Sum #1
β”œβ”€β”€ Merge Sorted Array #88
└── Valid Palindrome #125

interview_exercises/
β”œβ”€β”€ Reverse
β”œβ”€β”€ Duplicates
β”œβ”€β”€ Whitespaces
└── Longest

informatica/
β”œβ”€β”€ Factorial
β”œβ”€β”€ Fibonacci
β”œβ”€β”€ Prime
└── Table

I'm planning to expand it by adding data structures and more LeetCode problems.
If you're also learning Go or algorithms β€” I'd be happy if this helps you and to hear your feedback!

Repository: github.com/AshBuk/dsa-golang

Top comments (4)

Collapse
 
hashbyt profile image
Hashbyt

@ashbuk Wonderful initiative! Your method of emphasizing deep algorithm understanding and clean, idiomatic Go without the JavaScript sugar rush is very beneficial to students. The repository appears to be an excellent tool for developing that essential "close to the metal" intuition.

Collapse
 
ashbuk profile image
Asher Buk • Edited

Thanks! I plan to expand it and will try to keep it simple.

Collapse
 
rouqe profile image
Jimben Honeyfield • Edited

Interesting! I've been learning Go recently, and I think this could be just the thing for me to get more familiar with DSA in Go! Thanks for this!

Collapse
 
ashbuk profile image
Asher Buk • Edited

Thanks! I hope it really helps! I tried to keep things readable also for people coming from other languages. Though there are Go-specific approaches in there as well, in addition to the classic ones.