Live Site: https://bacbia3696.github.io/tutorials/
Interactive, browser-based labs for learning core data structures, graph algorithms, and computational geometry:
trie/: insert/search/prefix/delete tracing for Triekmp/: LPS construction + Knuth-Morris-Pratt string matching tracesegment_tree/: range update and range query with lazy propagationsparse_segment_tree/: dynamic segment tree with lazy node creation over large index spacesfenwick_tree/: point updates and prefix/range sums with BITdsu/: union/find/connected tracing with path compression and union by rankdijkstra/: shortest paths in weighted graphs with step-by-step relaxation tracingbellman_ford/: pass-by-pass relaxation tracing with negative-cycle detectionkruskal/: minimum spanning tree construction with sorted-edge + DSU cycle checksconvex_hull/: Andrew's monotonic chain tracing with orientation checks and hull assemblyline_sweep/: interval endpoint sweep tracing for active count and max overlap checkpointseulerian_path/: Eulerian path detection + construction with Hierholzer stack traversaltopological_sort/: Kahn's algorithm tracing for queue/indegree/order evolution
Each tutorial is a standalone HTML/CSS/JS module and reuses shared runtime utilities from shared/.
Tutorial metadata is centralized in shared/tutorial-registry.js.
Tutorial page shell bootstrap lives in shared/tutorial-page.js, landing cards are rendered by shared/landing-page.js, and tutorial app host wiring is centralized in shared/tutorial-app.js.
All tutorials are mounted through Lit custom elements in app.js, and algorithm/runtime logic lives in app-runtime.js.
No build step is required.
Internet access is required at runtime to fetch Lit ESM imports from CDN (shared/lit.js).
python3 -m http.server 4173Then open http://localhost:4173/ for the landing page, or navigate directly to a tutorial:
http://localhost:4173/trie/http://localhost:4173/kmp/http://localhost:4173/segment_tree/http://localhost:4173/sparse_segment_tree/http://localhost:4173/fenwick_tree/http://localhost:4173/dijkstra/http://localhost:4173/dsu/http://localhost:4173/bellman_ford/http://localhost:4173/kruskal/http://localhost:4173/convex_hull/http://localhost:4173/line_sweep/http://localhost:4173/eulerian_path/http://localhost:4173/topological_sort/
index.html: landing page skeleton rendered fromshared/tutorial-registry.jsviashared/landing-page.jstrie/,kmp/,segment_tree/,sparse_segment_tree/,fenwick_tree/,dsu/,dijkstra/,bellman_ford/,kruskal/,convex_hull/,line_sweep/,eulerian_path/,topological_sort/index.html: minimal page stub that delegates bootstrapping toshared/tutorial-page.jsstyles.css: module-specific theme and layoutapp.js: Lit host component template + runtime bootstrapapp-runtime.js: algorithm tracer + UI wiring
shared/tutorial-core.js: common operation runner, logger, shortcuts, code highlightershared/tutorial-bootstrap.js: common runner-control bindings and debounced resize wiringshared/tutorial-registry.js: centralized tutorial metadata (routing, page bootstrap, landing-card content)shared/tutorial-page.js: shared per-tutorial page bootstrap (head assets + host mount + module load)shared/landing-page.js: shared landing-page card renderer driven byshared/tutorial-registry.jsshared/tutorial-app.js: shared tutorial-app bootstrap helper that binds registrytagName+ runtime module loadingshared/tutorial-lit-host.js: shared Lit host wrapper for runtime bootstrap and cache-busted dynamic importshared/graph-core.js: shared SVG graph geometry/math helpers for graph tutorialsshared/graph-renderer.js: shared SVG graph rendering helpers (canvas prep, edges, nodes, arrow markers)shared/graph-input.js: shared graph input normalization/parsing/validation helpersshared/tutorial-base.css: shared layout/control primitivesshared/array-input.js: shared integer-array parsing and random-array generationshared/lit.js: shared Lit runtime imports used by Lit-migrated tutorialsshared/tests/shared-logic.test.mjs: deterministic shared logic tests (parser + runner behavior)shared/tests/smoke-check.sh: repo-wide syntax + shared-logic smoke checksshared/tests/manual-regression-checklist.md: per-module manual regression checklistAGENTS.md: contributor guide for coding, testing, and PR expectations
- Use modern ES modules (
import/export) and 2-space indentation. - Keep reusable behavior in
shared/; keep algorithm logic module-local unless reused. - Formatting is configured with Biome (
biome.json). - Tutorial pages apply automatic cache-busting for local CSS/JS on each load, so browser stale-cache issues are avoided during development.
- CDN dependency:
shared/lit.jsfetches Lit fromhttps://esm.sh/lit@3.3.1. Internet access is required at runtime. If the CDN or that exact version becomes unavailable, all tutorials will fail to load — consider pinning to a local copy if deploying in an offline or long-lived environment. - Install dev tools (once):
npm install- Format the repository:
npm run format- Check formatting in CI/local checks:
npm run format:check- Validate syntax quickly with:
shared/tests/smoke-check.shSee:
shared/tests/manual-regression-checklist.md