c/cpp implementation on Grokking Algorithm
It's a simple but funny book. https://www.manning.com/books/grokking-algorithms
Thank Yuci for the book, and an English PDF file can be found on website.
=====================================================
Since its simpleness and briefness, the implementation code here is not strictly correct.
Also I did not see any of the official source code. So, this is not a c/cpp implementation of the official python source code. Anyway, coding for fun is the theme.
=====================================================
run demo.cpp
All instances for input can be found in GrokkingAlgorithm.cpp, and the implementation details are implemented in 'UtilsGrokkingAlgo.cpp`.
Note:
- Code are implemented with Visual Studio 2013 on Windows 10, and possible mistakes can be found with GCC complier on Linux. Just modified by yourself.
=====================================================
- Binary Search for sorted sequence
- Select the maximum/minimum each time
- Recursive implementation of Fibonacci numbers
- An introduction to
Divide & Conquer (D&C), and many instances (Max Square,Sum,Quick Sort, andMerge Sort) are implemented
- An introduction to Hash tables, for quick search
- Apply BFS to find the shortest route (without weight side, like personal relation network) with
queue
- An algorithm to find the shortest route, suit to weighted directed acyclic graph with non-negative side
- Find a local optimal solution, approximating global solution, for NP problem. Select the local optimal solution at each step.
- Through some instances for better understanding of DP, such as
Knapsack Problem,Longest Common Substring, andLongest Common Subsequence. Learn to solve a hard problem by breaking it up into subproblems and solving those subproblems first (how to define and construct a suitable table for problems).
- A simple introduction to some machine learning methods (like K-nearest Neighbors, or Naive Bayes). No code supplied here.
- A brief navigation for more algorithms for further reading. They are
Trees,Inverted Indexes, 'The Fourier Transform, 'Parallel algorithms,MapReduce,Bloom Filters and HyperLogLog,The SHA Algorithms,Locality-Sensitive Hashing,Diffie-Hellman Key Exchange, andLinear Programming. No code supplied.