Skip to content

Latest commit

 

History

History
139 lines (100 loc) · 5.4 KB

README.md

File metadata and controls

139 lines (100 loc) · 5.4 KB

Overview

Algorithms 4/e textbook This repository contains C++ implementations of the algorithms and clients in the textbook Algorithms, 4th Edition by Robert Sedgewick and Kevin Wayne.

For the original Java source code, visit the official repository.

Algorithms

Fundamentals

Sorting

Symbol Tables

Graphs

Strings

Clients

Fundamentals

Sorting

Symbol Tables

  • TestSequentialSearchST | TestBinarySearchST | TestBST | TestRedBlackBST | TestSeparateChainingHashST | TestLinearProbingHashST: main_TestST.cpp.in

Graphs

Strings

Build and Run

Prerequisites

  • CMake 3.20 or later
  • C++ compiler with C++17 support

Steps

  1. Create and navigate to a build directory:

    mkdir build
    cd build
  2. Configure and build all targets. This will produce all clients:

    cmake ..
    cmake --build .

    Alternatively, build a specific target that produces a specific client:

    cmake --build . --target UF
  3. (Optional) Download sample input files from the book's website: https://algs4.cs.princeton.edu/code/.

  4. Run the client. You may redirect the input from a file (possibly one obtained in step 3):

    ./UF < tinyUF.txt

    Some clients may expect command-line arguments. For example:

    ./DepthFirstPaths tinyCG.txt 0

    This will run DepthFirstPaths on the graph in tinyCG.txt starting from vertex 0.