Question 1 6 points Save Answer Apply the bottom-up dynamic programming algorithm to the following instance of the knapsack problem where the knapsack capacity W = 4; Item Weight Value 1 1 15 2 N 20 3 1 7 4 2 10 1) Fill the following table: 0 1 2 3 4 0 w1v1 - 1 1 15 w2v2 == 2 2 20
Question 2 S points Save Answer Apply the radix sort to the array of integers: A = ( 765, 342, 109, 8, 23, 352, 265, 49, 923) Write the outputs of each pass (distribution and gathering back) of the algorithm in the provided blanks: Note: Do not write zeros before one-digit and two-digit numbers (Write 8 in the corresponding blank; do not write O8 or 008) Pass 1:
Question 3 6 points Save Answer Assume that the counting sort algorithm is applied to the array A of integers: A = (3.4, 2, 1, 3, 2, 1, 4, 2, 3, 5, 2, 3, 2, 4) Answer the following questions in the provided blanks: 1) What is the value of the upper bound Mof the range, which A's elements are from? M= 2) What are the values of the elements of the array Count? Count = { > 3) What are the values of the elements of the array Pos before the values of the output array A' are produced? Post ) 4) What are the values of the elements of the array Pos the values of the output array A' after passi * 4? Post
Question 1 6 points Save Answer Apply the bottom-up dynamic programming algorithm to the following instance of the knaps
-
- Site Admin
- Posts: 899566
- Joined: Mon Aug 02, 2021 8:13 am