Let A be an array of n elements. We are given an array L of the same length such that L[i] is the label of the element A[i]. Assume that each label is an integer in the range 1, 2, . . . , k, where k is a constant.
We want to assign a unique rank in the range 1, 2, . . . n to each element of A[i] according to the following rules:
• If A[i] and A[j] have different labels, the element with smaller label should have the lower rank. • If A[i] and A[j] have the same label, the element at lower index should have the lower rank.
Design a parallel algorithm to compute the ranks and find its running time