Hello, 2010/12/29 Anand <[email protected]>: > if I already have a structure indicating the position of the element in the > array. Then why do we need to sort. Question is to provide index of element > in O(nlogn).
You do not have a structure before preprocessing the data, whose complexity is O(nlogn) via qsort. Once you zip the zip the two array, and sort the new array as @Wladimir and @juver++ mention, you can provide each certain element's index in O(logn) via bsearch. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
