Question: Write a Boolean function SEG that takes two arrays A and B and their lengths LA and LB, and returns TRUE if B is a
Write a Boolean function SEG that takes two arrays A and B and their lengths LA and LB, and returns TRUE if B is a segment of A, FALSE if otherwise.
Bool SEG(int A [ ], int B [ ], int LA, int LB)
Examples:
A = [8 0 3 8 3 6 7 4 9 2 8 3 4 1 0 3]; // LA = 15;
B = [8 0 3]; // LB = 3
Statement is true
A = [8 0 3 8 3 6 7 4 9 2 8 3 4 1 0 3]; // LA = 15;
B = [8 3 6 7]; // LB = 4
Statement is true
A = [8 0 3 8 3 6 7 4 9 2 8 3 4 1 0 3]; // LA = 15;
B = [2 8 3 4 1]; // LB = 5
Statement is true
A = [8 0 3 8 3 6 7 4 9 2 8 3 4 1 0 3]; // LA = 15;
B = [0 3 1]; // LB = 3
Statement is false
A = [8 0 3 8 3 6 7 4 9 2 3 4 1 0 3]; // LA = 15;
B = [8 3 3 2]; // LB = 4
Statement is false
A = [8 0 3 8 3 6 7 4 9 2 3 4 1 0 3]; // LA = 15;
B = [8 3 1 4 0]; // LB = 5
Statement is false
Your main function should check all the 6 examples above, and all the 6 results should be included in your report
PLEASE explain all steps on how to do this problem in C++ , the book is called C++ for everybody 2nd edition
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
