I hope you solve all the points with the right answers and with Screenshot please,

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899559
Joined: Mon Aug 02, 2021 8:13 am

I hope you solve all the points with the right answers and with Screenshot please,

Post by answerhappygod »

I hope you solve all the points with the right answers and with
Screenshot please,
I Hope You Solve All The Points With The Right Answers And With Screenshot Please 1
I Hope You Solve All The Points With The Right Answers And With Screenshot Please 1 (155.39 KiB) Viewed 62 times
Question 2: (35 marks) You are requested to design an algorithm to check whether a key triple (sum of three numbers only) exist in a given array of size N) or not. If the key triple exists at least once then the algorithm should return "True"; otherwise "False". For example, given an array A [8, -3, 9, 5, -3, 11, 2, -7,4, 11] where the key triple is 21, then the required algorithm should return "True" because such triple exists at least once ex:(8,9,4). Another example, given the same array, where the key triple is 40, the required algorithm should return "false", as there is no any triple with sum equal to 40. a) Explain how a naïve algorithm would solve this problem. Design such algorithm (3 marks) and analyze its complexity. [Hint: explain your answer] (2 marks) b) This problem belongs to which type of problems: P, NP, NP-Hard, NP-Complete? (5 marks) c) Another algorithm would first sort the array to take advantage of the sorted value to facilitate the search for the required key pair: i. Design this algorithm (Hint: don't design a sorting function, simply use Sort(A) to do the job of sorting without going into the sorting details). (8 marks) ii. In order to get a better performance, which sorting algorithm “Sort(A)" would you choose to do this task? (2 marks) iii. What is the complexity of this algorithm? (5 marks) M269/ FTHE 2 of 3 2020-2021/Third d) Design the most efficient algorithm that can solve this problem in linear time (if possible), explain your idea (5 marks). [Request: create a random list of 6 numbers to trace back your algorithm (5 marks)]
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply