<a href="http://www.infoQuanta.com" target="_blank" rel="nofollow">infoQuanta</a> - parallel java programming made simple
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by Ilja Preuss:
That is, for n objects, you will have O(n^2) comparisons, no matter what exactly your algorithm looks like.
<a href="http://www.infoQuanta.com" target="_blank" rel="nofollow">infoQuanta</a> - parallel java programming made simple
Originally posted by Paul Fairhurst:
The OP mentioned a set of rules. Using a single sorting algorithm would only work for one rule.
[OCP 17 book] | [OCP 11 book] | [OCA 8 book] [OCP 8 book] [Practice tests book] [Blog] [JavaRanch FAQ] [How To Ask Questions] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Originally posted by Ernest Friedman-Hill:
I wouldn't say that; if there's any way to define an ordering consistent with the rules (surely there's some field you can sort on?) then you can sort the list, then just compare each item with its neighbors; that's O(n ln n).
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus