Given a set of n objects in no specific order (`n = 5` in this example):

```
{
    apple,
    orange,
    banana,
    cherry,
    cabbage
}

```

I'm trying to give a user several questions with three options, like so:

```
banana      vs.      cabbage
      (no preference)

```

after every question, it would make a new question with different options (no preference stays the same), efficiently collecting data on the user's preferences.

It would, after several (6 or 7 in this case) questions, give an ordered list (array) of the highest ranked objects in order:

```
{
    cherry,
    cabbage,
    orange,
    apple,
    banana
}

```

However, I don't know how such an algorithm would work or when it would know to stop. I'm sorry if this is a bad question, but I'm pretty new to algorithm design.

And I suppose it doesn't really matter, but I'm using JavaScript.

---

Okay, I'm revisiting this four months later, because I thought of a new method to do the sorting.

Perhaps, it would be more efficient to have a list of inferiors for each object, so that anything which is inferior to one object would be inferior for its superiors. I'm explaining this awfully, so here's a visual:

```
cherry > cabbage
cabbage > banana
cabbage > apple
apple > orange

thus, cherry > cabbage & banana & apple & orange

```

With the old method, with score:

```
apple vs. orange
apple vs. banana (e.g. apple wins)
apple vs. cherry (e.g. cherry wins)
apple vs. cabbage
orange vs. banana
orange vs. cherry
orange vs. cabbage
banana vs. cherry
banana vs. cabbage
cherry vs. cabbage

10 questions

```

The new method would make `cherry vs. banana` redundant because we already know that `apple > banana` and `cherry > apple`. I really only need to figure out how to code it.

The only problem arises with human circular logic (i.e. `a > b > c > a`), where this is a possibility, but thankfully this won't be a problem with my particular set.