diff --git a/.vitepress/config.mts b/.vitepress/config.mts index 54ac8e1..62281bd 100644 --- a/.vitepress/config.mts +++ b/.vitepress/config.mts @@ -91,7 +91,7 @@ export default withMermaid( { text: '6. Text Justification', link: '/exams/justify/' }, { text: '7. Photographing Skyscrapers', link: '/exams/photo-skyscraper/' }, { text: '8. Non-deterministic Finite Automata', link: '/exams/finite-automata/' }, - { text: '9. Least Common Anchestor', link: '/exams/least-common-ancestor/' }, + { text: '9. Least Common Ancestor', link: '/exams/least-common-ancestor/' }, { text: '10. Building Trees', link: '/exams/building-trees/' }, { text: '11. Square Code', link: '/exams/square-code/' }, { text: '12. Rock, Paper, Scissors', link: '/exams/rock-paper-scissors/' }, diff --git a/exams/finite-automata/index.md b/exams/finite-automata/index.md index 9f6c407..d61d985 100644 --- a/exams/finite-automata/index.md +++ b/exams/finite-automata/index.md @@ -73,7 +73,7 @@ To that end, implement the function ```haskell accepts :: (Eq a, Eq b) => Automaton a b -> [b] -> Bool ``` -which takes and automaton and a list of symbols that represents the word, and returns \texttt{True} +which takes and automaton and a list of symbols that represents the word, and returns **True** iff the word is accepted. Notice, `a` and `b` are instances of `Eq`. The function is used as follows. ```haskell diff --git a/exams/least-common-ancestor/index.md b/exams/least-common-ancestor/index.md index 9f40337..4190b74 100644 --- a/exams/least-common-ancestor/index.md +++ b/exams/least-common-ancestor/index.md @@ -35,7 +35,7 @@ $7$ and $7$ is $7$. In Racket, implement a function `(common-ancestor x y tree)` that takes two nodes `x`, `y` and a binary tree `tree`, and returns the least common-ancestor of `x` and `y` in `tree`. If `x` or `y` does not belong to `tree`, -the function returns \Verb|#f|. +the function returns `#f`. To represent binary trees in Racket, use the following structures: ```scheme @@ -66,7 +66,7 @@ Your file should be called `ancestor.rkt` and should export the `find-path` and (struct-out node) (struct-out leaf)) -(struct node (val kids) #:transparent) +(struct node (val left right) #:transparent) (struct leaf (val) #:transparent) (define (find-path x tree) diff --git a/exams/photo-skyscraper/index.md b/exams/photo-skyscraper/index.md index 81b3aa9..6613499 100644 --- a/exams/photo-skyscraper/index.md +++ b/exams/photo-skyscraper/index.md @@ -34,7 +34,7 @@ visible. In Racket, write a function `(best-view city)` that outputs the direction with the most roofs visible, along with the number of roofs visible from that direction. The direction should be one of -four symbols: `'N`, `'S`, `'E`, and `'N`. The result should be a pair of the format +four symbols: `'N`, `'S`, `'E`, and `'W`. The result should be a pair of the format `'(direction . number)`. ```scheme