Sissuire / Grokking-Algorithm

c/cpp implementation on Grokking Algorithm

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Grokking-Algorithm

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.

=====================================================

Usage

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.

=====================================================

Content

Ch-1, Introduction to Algorithms

  • Binary Search for sorted sequence

Ch-2, Selection Sort

  • Select the maximum/minimum each time

Ch-3, Recursion

  • Recursive implementation of Fibonacci numbers

Ch-4, Quick Sort

  • An introduction to Divide & Conquer (D&C), and many instances (Max Square, Sum, Quick Sort, and Merge Sort) are implemented

Ch-5, Hash Tables

  • An introduction to Hash tables, for quick search

Ch-6, Breadth-First Search

  • Apply BFS to find the shortest route (without weight side, like personal relation network) with queue

Ch-7, Dijkstra's Algorithm

  • An algorithm to find the shortest route, suit to weighted directed acyclic graph with non-negative side

Ch-8, Greedy Algorithms

  • Find a local optimal solution, approximating global solution, for NP problem. Select the local optimal solution at each step.

Ch-9, Dynamic Programming

  • Through some instances for better understanding of DP, such as Knapsack Problem, Longest Common Substring, and Longest 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).

Ch-10, K-nearest Neighbors

  • A simple introduction to some machine learning methods (like K-nearest Neighbors, or Naive Bayes). No code supplied here.

Ch-11, Where to Go Next

  • 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, and Linear Programming. No code supplied.

About

c/cpp implementation on Grokking Algorithm


Languages

Language:C++ 100.0%