Question: need this as soon as possible . A sorting problem of a different kind You have two arrays, A1 and A2. Al is an array

need this as soon as possible

need this as soon as possible . A sorting problem of a

. A sorting problem of a different kind You have two arrays, A1 and A2. Al is an array of n small toy cars. All the cars look exactly the same, but require a different voltage to run it. If the voltage of the battery is too high, it gives out a warning in red: "Voltage too high". If the voltage is too low, the car makes a low buzzing sound, but doesn't move (Hence if you connect a battery to a toy car, you would know whether the voltage is the right amount, or if it is too low, or if it is too high). A2 is an array of n batteries. Each battery providing a slightly different voltage. A2 is not sorted according to any criterion. Find an algorithm to sort the cars in array A1, in time Ofn log (n)). Write the algorithm in clear pseudo-code, and also explain it in English of how it works. (You only know of two algorithms: Mergesort and Quicksort with that running time. It has to be an adaptation of one of them. Would you partition intelligently, or would you merge intelligently? And it has to be an adaptation --. the original algorithms are not meant for such problems. But it is only a very slight adaptation if you get it.)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!