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} and analyse the 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-casel d) Prepare a brief report (250 words) comparing the two algorithms

icon
Related questions
Question

solve

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
complexity of your solution
and analyse the
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
Transcribed Image Text: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 complexity of your solution and analyse the 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
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 6 steps with 2 images

Blurred answer