Answered step by step
Verified Expert Solution
Question
1 Approved Answer
sealed trait NumTree case class Leaf(k: Int) extends NumTree case class Node (k Int, n1: NumTree, n2: NumTree) extends NumTree And the pattern matching for
sealed trait NumTree case class Leaf(k: Int) extends NumTree case class Node (k Int, n1: NumTree, n2: NumTree) extends NumTree And the pattern matching for a value v of type NumTree v match case Leaf (k) -> // Case number 1 case Node(k, Leaf(k1), rChild) if k1 >- k // Case number 2 case Node (k, nd1@Node (k1, _ _), nd2@Node (k2, 1child2, rChild2)) if kk1 && case// case 4 Consider the value below which matches case number 2 Node(10, Leaf (20), Leaf (30)) What is the value bound to rChild: enter your answer without whitespaces? What is the value bound to k1: enter your answer without whitespaces? Consider the value that matches case number 3. Node (10, Node (10, Leaf (5), Leaf (5)), Node (30, Leaf (4), Leaf (8))) What is the value bound to nd1 Make sure that there are no white spaces in your answer What is the value bound to rChild2
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started