Question: How many times does Loop 1 iterate on input lists A = (2, 7, 11, 16, 21) and B = (3, 4, 6, 9, 13)?
How many times does Loop 1 iterate on input lists A = (2, 7, 11, 16, 21) and B = (3, 4, 6, 9, 13)? Items are removed from the front of the list and added to the back.
// Loop 1:
While( size(A) > 0 AND size(B) > 0 )
If ( front(A) < front(B) ), then x := remove(B)
If ( front(A) front(B) ), then x := remove(A)
add(x, C)
End-while
A) 7
B) 5
C 8
D) 10
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
