Skip to content

jamylak/stringalgo1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

String Algorithm Geometry Lab

This is AI Generated focused on visuals not code quality. Raylib-based visual lab for exploring string algorithms as moving geometry instead of static formulas.

strings2.mov

The app ships with four canvases:

  • 1 Borders: prefix function and Z-array on the same sample string
  • 2 KMP: animated pattern matching with explicit failure jumps
  • 3 Suffix: suffix array ordering plus LCP adjacency structure
  • 4 Aho: trie edges, fail links, and multi-pattern scanning

What You See

Each page is built around one stable string example and an animated stepper driven by time.

  • Borders: prefix/suffix reuse becomes visible as copied spans and border arrows
  • KMP: the pattern row slides across the text while fallback jumps reuse prior work
  • Suffix: lexicographic suffix neighborhoods and repeated substrings show up through LCP highlights
  • Aho: goto edges consume characters, fail links preserve the longest viable suffix state

SPACE pauses the animation so you can inspect a frame without the state advancing.

Every page now also includes:

  • a compact pseudocode panel with the currently active lines highlighted
  • a short “why this happened” panel that explains the causal reason for the current transition

Controls

  • 1 2 3 4: switch pages
  • SPACE: pause or resume the animated algorithm state
  • r: reset camera and runtime state
  • q: quit
  • mouse drag or middle mouse: pan
  • mouse wheel: zoom around cursor
  • h j k l: fine pan nudges
  • click minimap: jump camera within the current page

Dependencies

  • raylib
  • a C compiler such as cc/clang
  • optional: pkg-config so the Makefile can auto-detect Raylib flags; otherwise it falls back to RAYLIB_DIR (default /opt/homebrew)

Build

make
make run

Extending It

This repo is now a reusable shell for deeper string-tech explorations. Useful next pages to add:

  • suffix automaton or suffix tree state growth
  • rolling hash and substring equality geometry
  • Manacher palindrome radii
  • wavelet tree or FM-index rank/select views
  • edit distance and alignment DP surfaces

About

String Algorithm Visualisation

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors