Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Hey can someone help with this. 2. Suppose that the symbol '@' is the empty set, the symbol 'U' is the set union operator, and
Hey can someone help with this.
2. Suppose that the symbol '@' is the empty set, the symbol 'U' is the set union operator, and the symbol l'is the set subtraction operator. For example: = 0 U{ 1,2,3} = {1,2,3} {1,2,3} U = { 1,2,3} {1,2,3}U{4} = {1,2,3,4} {1,2,3} {2} = {1,2,3} 1 = \{1,2,3} = {1,2,3}\ = {1,2,3} {1,2,3}\{4} = {1,2,3} {1,2,3}\{ 2 } = {1,3} The backracking algorithm MAKE-SETS uses these set operators. It is written in Cormen's pseudocode notation. The parameters n, k, and e are nonnegative integers. The parameter s is a set of nonnegative integers. MAKE-SETS(n, k) MAKING-SETS(n, k, 1, 0) MAKING-SETS(n, k, e, s) if k == 0 print s else for e' = e to n s=sU{e} MAKING-SETS(n, k-1, e'+ 1, s) s=s\{e} 2a. (5 points.) What sets will MAKE-SETS(4, 3) print? Hint: enumerate the recursive calls to MAKING-SETS breadth-first. 2b. (5 points.) Let I and m be nonnegative integers. What does MAKE-SETS(1, m) compute? Your answer must be one short sentence, stated in terms of I and m. 2. Suppose that the symbol '@' is the empty set, the symbol 'U' is the set union operator, and the symbol l'is the set subtraction operator. For example: = 0 U{ 1,2,3} = {1,2,3} {1,2,3} U = { 1,2,3} {1,2,3}U{4} = {1,2,3,4} {1,2,3} {2} = {1,2,3} 1 = \{1,2,3} = {1,2,3}\ = {1,2,3} {1,2,3}\{4} = {1,2,3} {1,2,3}\{ 2 } = {1,3} The backracking algorithm MAKE-SETS uses these set operators. It is written in Cormen's pseudocode notation. The parameters n, k, and e are nonnegative integers. The parameter s is a set of nonnegative integers. MAKE-SETS(n, k) MAKING-SETS(n, k, 1, 0) MAKING-SETS(n, k, e, s) if k == 0 print s else for e' = e to n s=sU{e} MAKING-SETS(n, k-1, e'+ 1, s) s=s\{e} 2a. (5 points.) What sets will MAKE-SETS(4, 3) print? Hint: enumerate the recursive calls to MAKING-SETS breadth-first. 2b. (5 points.) Let I and m be nonnegative integers. What does MAKE-SETS(1, m) compute? Your answer must be one short sentence, stated in terms of I and mStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started