Add Edit Distance and Catalan Numbers #3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR adds two new algorithm modules implemented in the project’s mapcode style and integrates them into the main document so they render with the existing
mapcode-vizvisualizer.What’s Included
algorithms/editdistance.typ
algorithms/catalannumbers.typ
Why this matters
Files Changed
Implementation notes
catalannumbers.typ:I = n:NN,X = [0..n] -> NN_bot,A = NN.rho(n)initializes the DP vector tobot(none),FfillsCat(0)=1and computesCat(i) = sum_{k=0}^{i-1} Cat(k) * Cat(i-1-k)when dependencies are ready.pi(n)returnsx[n].X_hvisualizes the DP vector and highlights updated entries per iteration (consistent withfibonacci.typ/factorial.typ).editdistance.typ:I = S × T,X = [0..|S|] × [0..|T|] -> NN_bot,A = NN.rho(S,T)initializes the full DP table tobot(none).Fimplements the standard Levenshtein DP update:iifj=0,jifi=0x[i-1,j-1]1 + min(x[i-1,j], x[i,j-1], x[i-1,j-1])pireturnsx[|S|, |T|].x_hrenders the DP table with labeled row/column characters and highlights changed cells per iteration (consistent withLongestCommonSubsequence.typ).Traces Generated: