### Errata for "Algorithms: A Functional Programming Approach"

 p iii "second edition" should be "first edition" p 12, line -14 value of e should be 2.718281828 p 22, line -6 hd and tl should be head and tail p 22, line -2 "higher or functions" should be "higher order functions" p 53, line 17 the first derivation on the left should be cancel 2 (f (3+1)) p 50, ex 2.8b rep4 should be rep 4 p 57, figure 3.1 uses the following definition double x = x + x instead of the one given on page 53 p 84, ex 4.6 remove all occurrences of unused argument a in function size p 91, last line O(log n) should be O(1) p 111 the argument rv in the definition of dRotRightLeft should be denoted rtv for compatibility with figure 5.11 (2 instances). Similarly with argument lv in the deinition of dRotLeftRight which should be denoted lfv p 120 the definition of qsort'' should be ```qsort'' l = qs l [] where qs [] s = s qs [x] s = (x:s) qs (pivot:rest) s = split pivot rest [] [] s split pivot [] lower upper s = qs lower (pivot : (qs upper s)) split pivot (x:xs) lower upper s = if x < pivot then split pivot xs (x:lower) upper s else split pivot xs lower (x:upper) s ``` p 142 and following In this section: signatures Ix a => a -> Graph a -> [a] should be (Ix a, Num b) => a -> Graph a b -> [a] p 147 in function unionFind (suggested by Herbert Kuchen) Replace ```unionFind :: (Eq n, Ord w) => (n,n) -> Table w n -> (Bool,Table w n) unionFind (x,y) t = = let xv findTable t x yv findTable t y ``` by```unionFind :: (Eq n, Ord n) => (n,n) -> Table n n -> (Bool,Table n n) unionFind (x,y) t = = let xv = findRoot t x yv = findRoot t y ``` and add the function to take care of transitive relations```findRoot:: (Eq n) => Table n n -> n -> n findRoot t x = let v = findTable t x in if v == x then v else findRoot t v ``` p 171, line 5 "as low and" should be "as low as" p 172, line 13 "there is an optimal" should be "the greedy algorithm always finds an optimal" p176 in figure 8.10 the number 32 shows up twice; the 32 in the leftmost column, in the third row down should be 35 p 202, line -8 "three operations" should be "four functions" p 224, ref 101 "Labraries" should be "Libraries"
Please let us know if you find any more errors.