Consider the instance of n-4, M-15 and w[1:4] = {3, 5, 10, 12) and use the...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Consider the instance of n-4, M-15 and w[1:4] = {3, 5, 10, 12) and use the SumOfSub given below to develop the tree which will be explored and how the method would apply bounding functions and actual tree which will be generated as explained in the class. Algorithm SumOfSub(s, k, r) 3 // Find all subsets of w[1: n] that sum to m. The values of a[j], // 1≤j<k, have already been determined. s = w[i] * [j] 4 // and r = = w[i]. The w[j]'s are in nondecreasing order. // It is assumed that w[1] ≤m and 5 1 w[i]> m. 6 { 7 8 1 2 9 10 11 12 13 14 15 16 17 18 19} // Generate left child. Note: s+w[k] ≤ m since Bk-1 is true. x[k] = 1; if (s+w[k] = m) then write (x[1: k]); // Subset found // There is no recursive call here as w[j]>0, 1≤j≤n. else if (s+w[k] + w[k +1] ≤m) then SumOfSub(s+w[k], k + 1, r - w[k]); // Generate right child and evaluate Bk. if ((s+r-w[k] ≥ m) and (s+w[k + 1] ≤m)) then { } x[k] := 0; SumOfSub(s, k + 1, r = w[k]); - Consider the instance of n-4, M-15 and w[1:4] = {3, 5, 10, 12) and use the SumOfSub given below to develop the tree which will be explored and how the method would apply bounding functions and actual tree which will be generated as explained in the class. Algorithm SumOfSub(s, k, r) 3 // Find all subsets of w[1: n] that sum to m. The values of a[j], // 1≤j<k, have already been determined. s = w[i] * [j] 4 // and r = = w[i]. The w[j]'s are in nondecreasing order. // It is assumed that w[1] ≤m and 5 1 w[i]> m. 6 { 7 8 1 2 9 10 11 12 13 14 15 16 17 18 19} // Generate left child. Note: s+w[k] ≤ m since Bk-1 is true. x[k] = 1; if (s+w[k] = m) then write (x[1: k]); // Subset found // There is no recursive call here as w[j]>0, 1≤j≤n. else if (s+w[k] + w[k +1] ≤m) then SumOfSub(s+w[k], k + 1, r - w[k]); // Generate right child and evaluate Bk. if ((s+r-w[k] ≥ m) and (s+w[k + 1] ≤m)) then { } x[k] := 0; SumOfSub(s, k + 1, r = w[k]); -
Expert Answer:
Answer rating: 100% (QA)
The given algorithm SumOfSub is a recursive algorithm for finding all subsets of a given set w1n tha... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1-5. Ivan's grandfather died and left a portfolio of municipal bonds. In 2012, they pay Ivan...
-
A researcher wanted to find out if there was difference between older movie goers and younger movie goers with respect to their estimates of a successful actors income. The researcher first...
-
The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1-6. On December 12, Irene purchased the building where her store is located. She paid...
-
Part C A 100.0 ? and a 150.0 ? resistor, both ratedat 2.00 W, are connected in series across a variable potentialdifference. What is the greatest this potential difference can bewithout overheating...
-
In general, the 45-day identification period and the 180-day exchange period for like-kind exchanges cannot be extended. Does this rule change if the like-kind property or the taxpayer involved in...
-
You are meeting with Wilhelm Schmidt, the Cruise Ship First Engineer, to help him with a maintenance scheduling problem. He needs help in assigning each of the six maintenance workers to specific...
-
Sun West Media Corporation had the following income statement and balance sheet for 2009 : Compute tor Sun West during 2009: a. Acquisition ol equipment. Sun West sold no equipment during the year....
-
Flaherty Accounting Services pays $2,000 per month for a tax software license. In addition, variable charges incurred average $9 for every tax return the firm prepares. a. Determine the total cost...
-
# 8 Sandra deposited $605 each month into her retirement, starting her senior year at FIT. She diversified her portfolio, so the interest rate averaged to a fixed rate of 9.75%. If she was 20 when...
-
In your opinion, based on the concepts presented within this chapter, what key fundamentals do managers need to understand to successfully manage a business?
-
If the launch site latitude is greater than the desired orbital inclination (Lo > i), which statement is true? options: the launch site will intersect the orbit plane once per day the launch site...
-
Determining Ending Balances in Land and Building Accounts Maldive Company completes the construction of a building. The following separate items are the costs relevant to the purchase of the lot and...
-
Engberg Company installs lawn sod in home yards. The company's most recent monthly contribution format income statement follows: Amount $ 98,000 Percent of Sales Sales Variable expenses Fixed...
-
The following data refer to snack maker Taquitos To Go for the year 20x1. Work-in-process inventory, 12/31/x0 Selling and administrative salaries Insurance on factory and equipment Work-in-process...
-
A large round loop of 269 turns and radius 67.0 cm carries a current of I = 78.0 A. A small square loop of 31.0 turns and 1.00 cm on a side is placed at the center of the large loop. The square loop...
-
1. Ren decides to test his swimming strength. He starts swimming across a river. He swims with a velocity of 3.5 mi/h north. The river is 0.61 mi wide and carries an eastward current of 1.25 mi/h....
-
Please help me with this Java Assignment. Solving the game of Boggle can be done elegantly with recursion and backtracking. Backtracking is a technique whereby an algorithm recognizes it is...
-
Velshi Printers has contracts to complete weekly supplements required by fortysix customers. For the year 2018, manufacturing overhead cost estimates total $600,000 for an annual production capacity...
-
Mary paid $2,000 of state income taxes in 2012. The total sales tax she paid during 2012 was $5,500, which included $3,000 for the cost of a new car. How should Mary treat the taxes paid on her 2012...
-
Ulysses and Penelope are married and file separate returns for 2012. Penelope itemizes her deductions on her return. Ulysses' adjusted gross income was $17,400, his itemized deductions were $2,250,...
-
Frank, age 35, and Joyce, age 34, are married and file a joint income tax return for 2012. Their salaries for the year total $83,000 and they have taxable interest income of $4,000. They have no...
-
A sample of college students was taken, and their ages were recorded. The following MINITAB output presents a confidence interval for the population mean age. a. How many degrees of freedom are...
-
Discuss the limiting factors for the maximum rated current and maximum rated voltage in a BJT and MOSFET.
-
The concentration of carbon monoxide in parts per million is believed to be normally distributed with a standard deviation = 8. A single measurement of the concentration is made, and its value is...
Study smarter with the SolutionInn App