5d9ae511d585eb00c5d6c6e55b41f51af53efef0
* add zig examples * improved zig binary search This commit improves the binary search code in zig. The function has been made generic and the logic has been cleaned up a bit. The code has been updated to work with zig versions >= 0.9 * simplify zig selection sort This commit simplifies the logic of the zig selection sort. It now swaps in place the elements of the array instead of creating another array. This avoids allocating heap memory. The code has also been upgraded to zig version 0.9.1 * make zig recursion examples generic This commit modifies the zig examples for the recursion chapter to be generic. It also updates the code to zig version 0.9.1 * update chapter 4 examples This commit updates the zig examples in chapter 4. In particular examples have been made generic where possible. The code has been updated to zig version 0.9.1 * update zig hash table examples This commit updates the examples for the chapter 5 about hash tables. Some improvements have been done (using a set instead of a map). The code has been updated to zig version 0.9.1 * update breadth first search zig example This commit updates the zig example for the breadth first search algorithm. It adds a unit test and updates the code to zig version 0.9.1 * revamp zig dijkstra example * add comments in dijkstra zig * fix zig greedy algorithm * add test for zig dijkstra * add test for zig greedy algorithm * improve zig chapter 9 exercise This commit improves the zig exercise to comput the longest common subsequence. A main function has been added and the allocator code has been extracted from the `subsequence` function.
Grokking Algorithms
This is the code in my book Grokking Algorithms.
Check out Python Tutor, a great website that guides you through Python code line by line.
Errata
Images
This repository contains every image in Grokking Algorithms in high resolution. These images are available for non-commercial use. If you use an image, please add "copyright Manning Publications, drawn by adit.io". You are welcome to use these images in any non-commercial materials (i.e. teaching materials, presentations, etc.)
Contributing
- The examples in this book are written in Python, but I'd like examples in Ruby, JavaScript, C, and other languages too. Please add examples in other languages!
- Pull request are the quickest way to contribute to this repository but unfortunately I am not as responsive to them as I'd like to be. I'll get to them but it might take a while!
- This repo is for easy to read examples. So even though I love well tested, optimized code, I won't be merging PRs related to tests or optimization, since those will increase cognitive load for readers.
Description
Languages
JavaScript
11.8%
Zig
10.6%
C#
6.3%
Java
6.1%
C++
5.9%
Other
59.3%