Skip to content

jamylak/kmp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

KMP Visualizer

This visualisation uses AI Generated code, finetuned for the best visualisation, not code quality

kmp.mov

Interactive Raylib explainer for Knuth-Morris-Pratt string matching, showing LPS construction, mismatch fallback, skip correctness, and a full execution trace across multiple teaching pages.

What This Visualisation Shows

  • How the LPS table is built from repeated prefix/suffix structure
  • How KMP avoids restarting from scratch on mismatches
  • Why overlap information justifies the skip
  • A live trace of pattern matching, fallback micro-operations, and runtime savings

Visual Map

flowchart LR
    A["Pattern"]
    B["Build LPS Table"]
    C["Scan Text"]
    D["Mismatch"]
    E["Fallback Via LPS"]
    F["Continue Matching"]

    A --> B
    B --> C
    C --> D
    D --> E
    E --> F
    F --> C
Loading

Controls

  • q: quit
  • Page-specific stepping and teaching controls are displayed in-app

Run

make run

About

KMP Visualiser

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors