Program contains 2 nested loops which contain 4 if conditionals. How many paths?

Posted by Student4Life on Stack Overflow See other posts from Stack Overflow or by Student4Life
Published on 2010-05-11T14:33:58Z Indexed on 2010/05/11 14:44 UTC
Read the original article Hit count: 353

Filed under:

In Roger Pressman's book, there is an example described of a program with 2 nested loops, the inner loop enclosing four if statements. The two loops can execute up to 20 times. He states that this makes about 10^14 paths. To get a number this large, it seems the paths inside the loops are multipllied by 2^40, i.e. 2^20 times 2^20 to account for all the possibilities of going through the two loops. I can't see why this factor is not just 400, i.e. 20 times 20. Can someone shed some light? It will help if you have the ppt slides and can see the program graph. Thanks.

© Stack Overflow or respective owner

Related posts about combinatorics