Six command-line programs that implement sorting, string searching, binary encryption, and lossless compression algorithms without external libraries. The collection was developed as university coursework and reorganized into a single buildable portfolio project.
| Program | Implementation |
|---|---|
sorting |
Counting sort and Roman sort for signed integers |
radix_sort |
Stable least-significant-bit radix sort for byte values |
string_search |
Knuth-Morris-Pratt and Sunday substring search |
playfair_cipher |
A 16x16 Playfair-style cipher over all 256 byte values |
shannon_fano |
Shannon-Fano compression and decompression |
lzw |
LZW compression with a configurable dictionary limit |
Requirements: CMake 3.16 or newer and a C++17 compiler.
cmake -S . -B build
cmake --build buildWith a multi-configuration generator such as Visual Studio, binaries are
usually written to build/Debug or build/Release. With Make or Ninja they
are written directly to build.
Run these commands from a temporary directory because the programs write
their result to out.txt, out.bin, out_e.txt, or out_d.bin.
# 0 = counting sort, 1 = Roman sort
sorting 0 examples/numbers.txt
radix_sort examples/bytes.txt
# 0 = KMP, 1 = Sunday search
string_search 0 Algorithms examples/text.txt
# Encrypt and decrypt a file with the 256-byte Playfair variant
playfair_cipher e portfolio examples/text.txt
playfair_cipher d portfolio out_e.txt
# Compress, then decompress the generated stream
shannon_fano c examples/text.txt
shannon_fano d out.bin
# LZW with a maximum dictionary size of 4096 entries
lzw c 4096 examples/text.txt
lzw d 4096 out.bin- The compression programs preserve arbitrary binary input, not only text.
- Search matches are written as zero-based offsets.
- The Playfair variant inserts marker bytes between repeated values and pads odd-sized input before encryption.
- Example inputs are intentionally small; generated results are ignored by Git.
All six targets build with GCC 13.1. The included examples were used to verify both sorting methods, both string-search methods, and byte-for-byte round trips for the Playfair, Shannon-Fano, and LZW programs.