Page 1 of 1

41 17 29 53 3 11 23 31 47 59 73 89 ✓ ✓ / 2 5 13 19 37 43 61 71 83 97 (1) Consider the above binary tree, which is repres

Posted: Sat May 14, 2022 7:45 pm
by answerhappygod
41 17 29 53 3 11 23 31 47 59 73 89 2 5 13 19 37 43 61 71 83 97 1 Consider The Above Binary Tree Which Is Repres 1
41 17 29 53 3 11 23 31 47 59 73 89 2 5 13 19 37 43 61 71 83 97 1 Consider The Above Binary Tree Which Is Repres 1 (82.37 KiB) Viewed 57 times
mcar (n:ns) = n
mcdr (n:ns) = ns
mcons m n = [m] ++ n
41 17 29 53 3 11 23 31 47 59 73 89 ✓ ✓ / 2 5 13 19 37 43 61 71 83 97 (1) Consider the above binary tree, which is represented as a list that adheres to the property [value, left, right], where value is an integer (further a prime number), and left and right are lists ([value, left, right] is a node in the binary tree). Provide a list that describes this structure. Given this binary tree structure, use our Haskell functions mcar and mcdr to access subtrees and elements of the list. (2) How can we access the left child root node? (3) How can we access the right child of the root node? (4) Provide applications of mcar and mcdr to access six values and/or subtree of the structure? You are free to choose which ones to access.