/Algorithm4

Code refactored by C++

Primary LanguageC++GNU Affero General Public License v3.0AGPL-3.0

Algorithm4-implemented by cpp

Algorithm 4th

Usage:

mkdir build
cd build
cmake ..
make -j8

Then go to the bin directory to find those executable files

The following content is deprecated... Now refactoring the docs and code...

This is a personal note of reading Algorithm 4th.

All the code(specified by "Algorithm x.y) in this book are going to be implemented by c++.

Some testfiles are from the official website, like largeUF.txt, 32Kints.txt.

Chapter1 I try to avoid using STL cause they are basic data structure.

Chapter2 - Chapter5

For convenient change the size of array and random access, I use the vector STL to be the sorted array.
Since our handmade data structure doesn't support generic template and range-for statement. In the later implementation I use (and only use) STL.

For example, although we implement a basic structure 2.6 MinPQ, the std::priority_queue in is more convenient to use.

Environment: linux-ubuntu
Compiler: g++ 9

1.3 Bags, Queues, and Stacks

1.5 Case Study: Union-Find

2.1 Elementary Sorts

2.2 Mergesort

2.3 Quicksort

2.4 Priority Queues

Heap:

3.1 Symbol Tables

3.2 Binary Search Trees

3.3 Balanced Search Trees

3.4 Hash Tables

4.3 Minimum Spanning Tree

4.4 Shortest Paths

5.1 String Sorts

5.2 Tries

5.3 Substring Search

5.4 Regular Expreesions

5.5 Data Compression