Question: Given two arrays: A[0..m-1] and B[0..n-1] write pseudo code in C++ for determining whether B is a subset of A. Assume that the arrays are

Given two arrays: A[0..m-1] and B[0..n-1] write pseudo code in C++ for determining whether B is a subset of A. Assume that the arrays are not in sorted order and that the elements of each array are distinct. Demonstrate your solution using a Hash Table and evaluate the complexity of your algorithm.

Examples:

Input: A = {11, 1, 13, 21, 3, 7}, B = {11, 3, 7, 1}

Output: B is a subset of A

Input: A = {10, 5, 2, 23, 19}, B = {19, 5, 3}

Output: B is not a subset of A

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 Databases Questions!