What are your fruit preferences? Do you have a complete ordered list of preferences in your mind, or you have fruits that you “like more than most,” “fruits that you are“ less than most, ”and everything else that you don’t have any strong feelings - or you have not even tried.
The problem with how you formulated your problem is that you assumed that a person’s preferences are a general order that is naturally encoded as a list. Indeed, human preferences are often a partial order that is naturally encoded as a directed acyclic graph .
For example, for a set of fruits {Apple, Orange, Kiwi, Banana, Melon, Starfruit} I may have fruit preferences as follows:
Melon < Apple Apple < Banana Banana < Kiwi Banana < Orange
A good way to get a partial order based on user input is to simulate radix sorting . To get started, ask the user to choose for each fruit whether they like it, dislike it, feel neutral or don't know. I would answer like this:
Like Dislike Neutral Unknown Apple x Orange x Kiwi x Banana x Melon x Starfruit x
Assuming Dislike < Neutral < Like , these answers encode the following information, although I answered only as many questions as there are:
Melon < Apple Apple < Orange Apple < Kiwi Apple < Banana
Then determine what answer received the majority of control signs. In this case, I seem to have 3 fruits that I like, 1 I don’t like, and I feel neutral (unless peanut butter is used), and 1 I have never tried (therefore, I have no preferences for others fruit).
So, a natural place to further study my preferences would be within the fruits that I like. The problem is recursive: now you want to determine my preferences for a set of fruits {Orange, Kiwi, Banana} . You can ask me which of these fruits is my favorite, and I would click Orange and Kiwi . This tells you the following:
Banana < Orange Banana < Kiwi
In combination with the first round of information, you now have:
Melon < Apple Apple < Orange Apple < Kiwi Apple < Banana Banana < Kiwi Banana < Orange
Apple < Banana and Banana < Kiwi mean Apple < Kiwi ; Apple < Banana and Banana < Orange mean Apple < Orange . Therefore, we can eliminate redundant information to obtain the following:
Melon < Apple Apple < Banana Banana < Kiwi Banana < Orange