Question: Consider the Binary Search Tree (BST) data structure. (10 Points) Let A and B be unordered lists that have no duplicates. A) Using the BST

 Consider the Binary Search Tree (BST) data structure. (10 Points) Let A and B be unordered lists that have no duplicates. 


A) Using the BST data structure, write a function Intersect(A,B) that returns the list of all the elements that occur in both A and B. 


B) Using the BST data structure, write a function Difference(A,B) that returns the list of all the elements that occur in A but not in B. 


C) Using the BST data structure, write a function equalSet(A,B) that returns True if and only if A and B have the same elements. 


So, for example ([1, 5, 2, 7, 9], [2, 5, 9, 1, 7]) should return True, whereas ([1, 5, 2, 7, 9], [2, 6, 9, 1]) should return False. Test cases: 1. A = [], B = [] 2. A = [1,2,3], B = [] 3. A = [], B = [1,2,3] 4. A = [1,2,3,4,5,6,7,8,9,10], B = [10,9,8,7,6,5,4,3,2,1] 5. A = [10,3,5,4,7,6,9,8,10,1], B = [10,9,8,7,6,5,4,3,2,1] 6. A = [1,3,2,7,8,9,10,4], B = [10,9,7,6,5,3,2,0,11]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Algorithms Questions!