Question: In C++, Given: Set A = {3,4,6,5,7} and Set B = { 3,7,5,6,4 } Write a program to proof set A and set B are
Given: Set A = {3,4,6,5,7} and Set B = { 3,7,5,6,4 } Write a program to proof set A and set B are equal. Note: 1. To prove two set A and B are equal. You need to proof the A is subset of B and B is subset of A 2. To prove Set A is a subset of B, you need to go through every element in A to check whether B contains the same element. . If all elements in A can be found in B, then A is the subset of B. Coding Instruction: 1. Write a loop to go through all elements in A 2. Within the first loop, write a nested loop go through all elements in B . Give an element in A, Check if B contains the same element a. If B contains it, move to next element in A b. Otherwise A is not subset of B 4. After find all elements in A are contained by B, then A is subset of B 5. Modify and repeat step 1-4 to check if B is subset of A 6. If B is subset of A and A is subset of B, then A and B are equal, otherwise A and B are not equal
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
