Sorting problem: We are given a sequence of numbers x_1, x_2,x_n. We scan these
ID: 675263 • Letter: S
Question
Sorting problem: We are given a sequence of numbers x_1, x_2,x_n. We scan these numbers from left to right, and put x_i to left of x_i =1 if x_i is smaller than x_i -1. In other words, we continuously move x, to the left until the numbers to its left are all smaller than or equal to it. Design an algorithm to resolve this sorting problem. Please analyze the time complexity of your above designed algorithm, in terms of both the best case and worst case complexities. Rank finding problem: In the 2-dimension space, we shall say that a point A=(a_1, a_2) dominates a point B=(b_1, b_2) if and only if a_1 > b_1 and a_2 > b_2. For the points in Figure 1, we have the following relation: B, C and D dominates A. D dominates A, B and C Figure 1: A case of showing the dominance relation Given a set of n points, the rank of a point X is the number of points dominated by X. Design and algorithm to find the rank of every point.Explanation / Answer
1.
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.