Question: Please help me with this question. Which option would be correct? Thank you. { a ca (7) Consider two arrays of size n of type

Please help me with this question. Which option would be correct? Thank you.
{ a ca (7) Consider two arrays of size n of type bool. Each array is randomly initialized to a collection of n Boolean values (either true or false). We want to write an algorithm that determines how many times both arrays are set to true at any given index. Let's say we have array A and array B as below. si as 6 5 A = [ao][az]... [an-1] 3 B = [bo][bi]...[bn-1] We want to check if ao and bo are both true, aj and b are both true, finally, an and bn are both true. Which of the below for loops most effectively counts the number of indexes at which A and B are both true. = (a) bool a[n]; // Assume A Initialized bool b[n]; // Assume B Initialized int set = 0; for (int i 0; i
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
