Question
thumb_up100%
need solve it
![Given an integer array [A], efficiently find a descending sorted triplet such that:
A[i]> A[i]> A[k] and 0 <=i<j <k <n, where n is the array size.
For example,
Input: A[] = {9, 1, 6, 7, 3, 4, 5)
Output: Any one of the following triplets:
(9, 7,5)
(9, 7, 4)
(9, 7, 3)
(9, 6, 5)
(9, 6, 4)
(9, 6, 3)
a) Design a brute-force algorithm to solve this problem
complexity of your solution
b) Design a more efficient algorithm to do the same task with less complexity
and analyse the complexity of your solution.
c) Develop a python code to implement your efficient algorithm.
depend on the correctness of the code, indentation, comments, test-case]
d) Prepare a brief report (250 words) comparing the two algorithms
and analyse the](https://content.bartleby.com/qna-images/question/f7037fa1-d9ae-4bcc-aba2-58f628bd28fc/3ef5cf51-6648-44ba-808d-b7b48a66e6f2/1ud1ve_thumbnail.png)
Transcribed Image Text:Given an integer array [A], efficiently find a descending sorted triplet such that:
A[i]> A[i]> A[k] and 0 <=i<j <k <n, where n is the array size.
For example,
Input: A[] = {9, 1, 6, 7, 3, 4, 5)
Output: Any one of the following triplets:
(9, 7,5)
(9, 7, 4)
(9, 7, 3)
(9, 6, 5)
(9, 6, 4)
(9, 6, 3)
a) Design a brute-force algorithm to solve this problem
complexity of your solution
b) Design a more efficient algorithm to do the same task with less complexity
and analyse the complexity of your solution.
c) Develop a python code to implement your efficient algorithm.
depend on the correctness of the code, indentation, comments, test-case]
d) Prepare a brief report (250 words) comparing the two algorithms
and analyse the
Expert Solution
![Check Mark](/static/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 5 steps with 1 images
![Blurred answer](/static/blurred-answer.jpg)
Knowledge Booster
Similar questions
- Given the following graphical solution, the feasible area is x2 N 2 a. None of the answers b. EGP C. GCO d. EGOI ↑ x1arrow_forwardPlease show steps clearlyarrow_forward8. A school is creating class schedules for its students. The students submit their requested courses and then a program will be designed to find the optimal schedule for all students. The school has determined that finding the absolute best schedule cannot be solved in a reasonablo time. Instead they have decided to use a simpler algorithm that produces a good but non-optimal schedule in a more reasonable amount of time. Which principle does this decision best demonstrate? O A Unreasonable algorithms may sometimes also be undecidable O B. Heuristics can be used to solve some problems for which no reasonable algorithm exsts O C. efficiency Two algorithms that solve the same problem must also have the same O B. Approximate solutions are often identical to optimal solutionsarrow_forward