Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Aufgabenblatt 8, Aufgabe 52a
- --hier stimmt alles, wie Musterlösung
- data Ord a => Suchbaum a b = Leer | Knoten a b (Suchbaum a b) (Suchbaum a b)
- deriving Show
- finde :: Ord a => a -> Suchbaum a b -> Maybe b
- finde _ Leer = Nothing
- finde x (Knoten a b lbaum rbaum)
- | x == a = Just b
- | x < a = finde x lbaum
- | otherwise = finde x rbaum
- --zum Testen, leider falsch! warum?
- mybaum :: (Ord a, Num a, Ord b, Num b) => Suchbaum a b
- mybaum = Knoten 15 30 (Knoten 10 40 Leer Leer) (Knoten 20 60 Leer Leer)
Add Comment
Please, Sign In to add comment