I have an array that stores the various names like
arr1=aa bb cc dd ee

In the second array i have the hierarchy ranking of these names (i.e. the order in which they exist.) like
arr2=s(cc) null s(aa) s(dd) s(bb)

(Here s(cc) means that the first element in arr1 comes after element cc )

Now according to the hierarchy i need to arrange the elements of first array.
(hope i am not confusing)