find duplicates in an array with space efficiency
Anonymous
Assuming that for every array element we have: 1. a .equals() type of method/function (for checking duplicates) 2. a .compare() type of method/function (for sorting) Since you are striving for space efficiency and not speed, maybe what you could do is sort the array using a good sorting technique (that does not cost too much space to perform) and then run through array checking for adjacent duplicates (as sorting will put duplicates next to one another)..
Check out your Company Bowl for anonymous work chats.