Question: You are given a sequence x 1 , x 2 , dots, x n of n real numbers between 0 and 1 ( inclusive )
You are given a sequence dots, of real numbers between and inclusive You want
to reorder the numbers such that the sum of the difference between each pair of adjacent elements
is less than That is you want to find a permutation dots, where
For example, if we have the sequence the sum of differences is
If we rearrange the numbers as the sum is then
Design an algorithm that finds such an order in time.
Hint: Split the interval into smaller ranges. The BuCKetSorT algorithm might provide
inspiration. Note however that BUCKETSoRT is not a sorting algorithm!
Rubric.
In English, describe an algorithm that rearranges the sequence such that the given sum is
less than
Prove that the sequence created by your algorithm satisfies the difference requirement.
Justify that your algorithm runs in time.
Expected response length: up to one page.
Please do this question im so stuck
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
