19. (a) Given an a array of n real numbers.,. eign a greedy lgorithms that fias
ID: 3705824 • Letter: 1
Question
19. (a) Given an a array of n real numbers.,. eign a greedy lgorithms that fias the minimum number of values needed to cover all the array elements An array element a is covered by a value x if xsac+1 For example, if the array contains 5 real numbers:(0.9,0.1, 1.5, 1.1,0.8), them the minimum number of values needed is 2, specifically, 0.1 and 1.1. The first value 0.9,0.1 and 0.8. The second value covers 1.5 and 1.1 Write your algorithm in pseudocode. What is the efficiency class of your algorithm? (b) Use any algorithm design technique other than brute-force to solve the following problem: Find the length of the longest increasing subsequencermt ot integers For example: if the list contains (4,5,2, 1,6),then the longest increng 4, 5, 6. The length is 3 Another example: if the list contains (9, 2, 5, 1. 7. 11, 8, 10, 12, 6), then the longest increasing subsequence is 2, 5,7,8, 10, 12. The length is 6 Write your algorithm in pseudocode. Which algorithm design technique did you use?Explanation / Answer
Hi, I would like to solve part b from your questions as u say any of them. So algorithm is below.
If you need any other help comment me.
This algorithm is not a brute force this used Dynamic programming.
Algorithm :
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.