|
-
March 2nd, 2008, 07:45 AM
#1
Finding n-th largest element in two sorted lists
I have a little optimization problem, I have two lists of sorted elements and I need to pick n-th largest element from both lists combined. Now, since the data in both lists changes and I do not have control over the changes, I cannot combine the two lists. Both lists can also be quite large. A naive solution would be to just do a linear search from the end and find n-th largest element. However, I have a feeling that I can do it faster since both lists are sorted. I should be able to apply some sort of binary search, but I can't wrap my mind around the idea of using binary search on two lists simultaneously. If I can use binary search then I would have the awesome complexity of log(n) and that would be a huge boost in performance for the application I use this in. Does anyone have any ideas on this?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|