export function rabinKarp(text: string, pattern: string): number[]
Clear that it takes two strings and returns match positions. No separate explanation needed. export interface ShortestPathResult<T> {
dist: Map<T, number>;
parent: Map<T, T | undefined>;
}
export function dijkstra<T>(graph: Graph<T>, source: T): ShortestPathResult<T>
It's also lightweight, flexible, has familiar C-like syntax, and unlike pseudocode — you can actually run everything.