Page 1 of 1

Write a C++ (or any programming) program/function to check ACB. Algorithm 6.1.1 Testing Whether ACB [The input sets A an

Posted: Fri May 20, 2022 5:10 pm
by answerhappygod
Write A C Or Any Programming Program Function To Check Acb Algorithm 6 1 1 Testing Whether Acb The Input Sets A An 1
Write A C Or Any Programming Program Function To Check Acb Algorithm 6 1 1 Testing Whether Acb The Input Sets A An 1 (252.38 KiB) Viewed 54 times
Write a C++ (or any programming) program/function to check ACB. Algorithm 6.1.1 Testing Whether ACB [The input sets A and B are represented as one-dimensional arrays a[1], a[2], ..., a[m] and b[1], b[2),..., b[n), respectively. Starting with a[1] and for each successive ali] in A, a check is made to see whether a is in B. To do this, a is compared to successive elements of B. If a is not equal to any element of B, then the output string, called answer, is given the value “A ¢ B." If a equals some element of B, the next succes- sive element in A is checked to see whether it is in B. If every successive element of A is found to be in B, then the answer never changes from its initial value "A C B.”] Input: m la positive integer), a[1], a[2],..., a[m] (a one-dimensional array repre- senting the set A), n (a positive integer], b[1], b[2],..., b[n] [a one-dimensional array representing the set B] Algorithm Body: i:= 1, answer :="ACB” while (i sm and answer = "A CB") j:= 1, found :="no" while (j = n and found="no") if a = b[j] then found :="yes" j:=j+1 end while [if found has not been given the value “yes” when execution reaches this point, then a € B.) if found = "no" then answer := " AB" i:=i+1 end while Output: answer (a string] Please attach a screenshot of the output.