August 13th, 2024

Go Algorithms and Data Structures: Best Practices for Beginners

The GitHub repository features a variety of algorithms implemented in Go, covering domains like data structures, sorting, and cryptography. It is open-source, encourages contributions, and serves educational purposes.

Read original articleLink Icon
Go Algorithms and Data Structures: Best Practices for Beginners

The GitHub repository is a collection of algorithms implemented in the Go programming language, featuring a wide range of algorithms across various domains such as data structures, mathematical algorithms, and string manipulation. It serves educational purposes and is open-source under the MIT License. Key features include search algorithms like Boyer-Moore and KMP, sorting algorithms such as QuickSort and MergeSort, data structures including linked lists and trees, mathematical algorithms like GCD and Fibonacci, cryptographic algorithms such as RSA, graph algorithms including Dijkstra's and Prim's, and dynamic programming algorithms like Knapsack and Coin Change. The repository encourages contributions and provides guidelines for those interested in enhancing the collection. It is a valuable resource for learning algorithm implementation in Go, as well as for reference in coding interviews and competitive programming.

- The repository contains a variety of algorithms implemented in Go.

- It is open-source and licensed under the MIT License.

- Contributions are encouraged with established guidelines.

- The repository serves as a resource for educational purposes and coding interviews.

- It includes algorithms from multiple domains, including search, sorting, and cryptography.

Link Icon 5 comments
By @tialaramex - 6 months
For most of the algorithms even if the supplied algorithm is a naive approach it's harmless, maybe some people learn from it, and some don't, nobody is harmed so it's net good.

Unfortunately this has cryptographic algorithms, and while they're initially quite simple like XOR, eventually we have what look at a glance like more substantial and useful primitives such as RSA encryption†. The authors doubtless know not to use these, but to a student it all seems to work as supplied, but of course it doesn't.

I think the simplification needed to make RSA explicable in this setting makes it so useless and abstracted from reality that it's net harmful, and I'd recommend against providing any of the cryptographic algorithms for that reason.

† Yes I'm aware that RSA encryption is obsolete. Does this site feel like the right pitch to explain that to students ?

By @vrnvu - 6 months
Please, beginners, do not take "Best practices" too seriously. For example:

https://github.com/TheAlgorithms/Go/blob/master/strings/pali...

Can you tell how many extra memory allocations we are making to solve this problem? And how many are really needed? We could solve this with a for loop by directly comparing the characters and skipping non-alphabetical ones. This would be simpler to read and more efficient.

We should be careful with what we call "best practices for beginners", as they can sometimes lead to unnecessary complexity and inefficiency.

By @lionkor - 6 months
I can't find many, if any, unit tests. Is that intended? If so, why?