# discrete structures hw questions

Problem 1: Sec 2.4, #17(a-d)

Problem 2: Sec 2.4, #36

Problem 3: Sec 2.4, #39

Problem 4: Sec 2.4, #40

Problem 5: Sec 5.1, #5

Problem 6: Sec 5.1, #6

Problem 7: Sec 5.1, #13

Problem 8: Sec 5.1, #14

Problem 9: Sec 5.1, #20

Problem 10: Sec 5.1, #32

Problem 11: Sec 5.1, #36

Problem 12 : Assume that is a positive integer. For each of the following algorithm segments, how many times will the innermost loop be iterated when the algorithm segment is implemented and run?

• for k := 1 to n
• for k := 1 to n
• for k := 1 to n-1

for j := 1 to k

[Statements in the body of the inner loop, none containing branching statements that lead outside the loop]

next j

next k

for j := 1 to k

for i := 1 to j

[Statements in the body of the inner loop, none containing branching statements that lead outside the loop]

next k

next j

next i

for j := 1 to k+1

[Statements in the body of the inner loop, none containing branching statements that lead outside the loop]

next j

next i

book:

http://www2.fiit.stuba.sk/~kvasnicka/Mathematics%20for%20Informatics/Rosen_Discrete_Mathematics_and_Its_Applications_7th_Edition.pdf