Question: can someone help me correct my code using bitlist to solve this question or if you can code it again using bitlist will be much

can someone help me correct my code using bitlist to solve this question or if you can code it again using bitlist will be much appreciated. thanks.  can someone help me correct my code using bitlist to solve
this question or if you can code it again using bitlist will
be much appreciated. thanks. Task 2: Maximum sum increasing sub-sequence (4 Marks)

Task 2: Maximum sum increasing sub-sequence (4 Marks) Create a Python module called max sum.py. Within this module implement the following task. (You may not import any other libraries or modules.) Given an non-empty list of integers, write a function max.sum(lst) that return a list of length of 2. The first element in output list should be an integer value representing the greatest sum that can be generated from a strictly-increasing sub-sequence in the list. The second element should a list of the numbers in that sub- sequence. A sub-sequence is defined as a set of numbers that are not necessarily adjacent but in the same order as they appear in the list. Assume that there will be only one increasing sub-sequence with the greatest sum. Input: a non-empty list of integers Output: returns a list of length of 2. The first element in output list should be an integer value representing the greatest sum that can be generated from a strictly-increasing sub-sequence in the list. The second element should a list of the numbers in that sub-sequence. Examples a) Given 1st1-[-1], calling max sum (1st1), will return [-1,[-1]]. b) Given 1st2-[10,70,20,30,50,11,30], calling max sum (1st2), will return [110, [10, 20, 30, 50]]. c) Given 1st3=[-5,-4,-3,-2,-11, calling max.sum (1st3), will return (-1, (-1]]. d) Given 1st4-[10,15,4,5,11,14,31,25,31,23,25,31,50], calling max.sum (1st4), will return [164, [10, 11, 14, 23, 25, 31, 50]]. Marking Guide (total 4 marks) Marks are given for the correct behaviour of the different functions: (a) 2.0 marks to find all the feasible solutions. 2.0 marks to find the optimal solutions. in_8.txt O graph A.txt 1st1 = [-1] lst2 = [10,70,20,30,50,11,30] 1st3 = [-5,-4,-3,-2,-1] Ist4 = [10,15,4,5,11,14,31,25,31,23,25,31,50] def find sum(arr): summ = 0 for i in arr: sunm + i return summ finds the Sum.of. the sub seguense def max_sum(lst): n = len(lst) ans = bitlists(n) ans (01.append (lst[0]) for i in range(1, n): for j in range(i): if lst(1] > lst[j] and find_sum(ans (1]) find sum(feasible)): feasible - x 31 32 33 if sum(feasible) find_sum(feasible)): 31 32 feasible = x 33 34 if sum(feasible)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!