Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • 1
    I wager that an algorithm with your desired characteristics is not possible. Commented Dec 31, 2013 at 20:46
  • I have a feeling that might be the case. Any ideas for a proof? And while Jules' answer doesn't work, extra memory itself isn't out of bounds even though I'd prefer (there's that word again) to stay away from O(n) extra memory. For example an array of indices would be acceptable. I'll keep looking and add an answer if I ever find one. Commented Dec 31, 2013 at 21:14
  • I think I've figured out a merge algorithm to do this. I'll write it up and post it as an answer, but I'm pretty sure it is O(n log n) so I won't accept it since it won't match the criteria. Commented Dec 31, 2013 at 22:19
  • Other than array of indices, a bit array can be used to indicate the position of unique items. (Though I must remind that P.SE is in general not suitable for questions requiring CS Theory proofs. There is a CS Theory site on Stack Exchange suitable for this type of questions.) Commented Jan 6, 2014 at 12:25
  • Well maybe it would be better to move this question to that site instead. Commented Jan 7, 2014 at 16:48