I don't know how to answer your question with log(n) thingy.
But in my mind, sorting the source array is not required.
What I would do:
- traverse source
- add entry from source array to target array only if bigger than any entry present in target
- sort the target (should have max 4 elements)
- remove 4th element if present (should be the smallest)
- repeat until you check each entry of source array
Not sure if it's better than sorting the source array though.