Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Java How To Program Late Objects Version

Authors: Paul Deitel, Deitel & Associates

8th Edition

0136123716, 9780136123712

More Books

Students also viewed these Algorithms questions

Question

Evaluate using Pascal's Triangle. 1. 2. 7, (2, 10 4

Answered: 1 week ago