186k views
2 votes
Determine how many times the innermost loop will be iterated when the algorithm segment is implemented and run. (Assume that m and n are positive integers.)

for j := 1 to m
for k := 1 to n
[Statements in body of inner loop.
None contain branching statements that
lead outside the loop.]
next k
next j

1 Answer

5 votes

Answer:

mn

Step-by-step explanation:

For each of the m iterations of the outer loop, the inner loop is run n times. The total number of times the innermost loop is run is ...

m×n

User Dmytro Dzyubak
by
5.6k points