Question: BST.Scala In this Scala programming assignment, you wil implement various set operations on Binary Search Tree implementations of Sets of integers. You will use case
In this Scala programming assignment, you wil implement various set operations on Binary Search Tree implementations of Sets of integers. You will use "case classes" of Scala to represent a binary tree object BST abstract class BT case class Tree (eft: B7.value: Int, right: BT) extends B object Ni extends BT // returns the smallest element in BST t // returns the largest element in BSzt // returns true if t is a BST and false otherwise // r.turns true if is & menter e? ?5T t, fals. otherwise def menberBST (x: Int . tl BT): Boolean ??? // returns a new BST obtained by inserting x in BST t. // should return tifx is already int // returns the height of t; // returns a new BST obtained by deleting x in BST t. I/ should return t if x is not in t // returns the number of elements in t def toString (t ; String " t match { case Tree(left, value,right) tostringhefe)value.toString tostringtzight case Nil"nil case Tree (Left,value,right) Printin (toString2(5) } printintoStringts)+
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
