Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Given an array of different integers, replace each element by its corresponding descending order in the array. The maximum array element has the order
Given an array of different integers, replace each element by its corresponding descending order in the array. The maximum array element has the order 1; the second maximum element has order 2, and so on... For example, Input: [10, 12, 17, 14, 8, 3, 22} Output: {5. 4. 2, 3, 6, 7, 1} a) Design a brute-force algorithm to solve this problem (4 marks), and analyse the complexity of your solution (2 marks) b) Design a more efficient algorithm to do the same task with less complexity (7 marks), and analyse the complexity of your solution. (3 marks) c) Develop a python code to implement your efficient algorithm. (10 marks) [The marks depend on the correctness of the code, indentation, comments, test-case] d) Prepare a brief report (250 words) comparing the two algorithms (4 marks)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Lets address each part of your question a Bruteforce algorithm Iterate through each element in the a...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started