What's the name of this sorting(?) algorithm? Given the options of:

Red
Orange
Yellow
Green
Blue
Violet

You want to find your favorite color by comparing all pairs to each other, like so:
Red vs...

Red vs Orange = Orange
Red vs Yellow = Red
Red vs Green = Red
Red vs Blue = Red
Red vs Violet = Red

Orange vs...

Orange vs Yellow = Orange
Orange vs Green = Orange
Orange vs Blue = Orange
Orange vs Violet = Orange

Yellow vs...

Yellow vs Green = Green
Yellow vs Blue = Yellow
Yellow vs Violet = Yellow

Green vs...

Green vs Blue = Green
Green vs Violet = Green

Blue vs...

Blue vs Violet = Violet

In the end you'll find your &quot;most preferred&quot;. Not sure if you get a full order of preference.
What's the name of this...thing?
Also as D.W. described, I believe it's solved by which color won most often. So in the example above:

Orange = 5
Red = 4
Green = 3
Yellow = 2
Violet = 1
Blue = 0
If we can assume that there is a total order on all colors: to find the largest element, there is a straightforward $O(n)$-time algorithm to find it: you scan through all colors, keep tracking of the largest element seen so far:

Set $m$ to the first color.
For each other color $c$:

Set $m := \max(m,c)$.



(Here $\max$ refers to the larger of the two colors, i.e., whichever is more preferred.) There is no need to &quot;sort&quot; all of the colors to find the largest (most favorite) color.
Alternative, suppose we cannot assume the colors are totally ordered, and the order is a partial order.  Then you'd need to specify what is meant by &quot;most favorite&quot; color.  One possible definition is a maximal color, i.e., one where no other color is more preferred.  (Note that there may be multiple such colors.)  If so, you can again find it via the same linear scan (if two elements are incomparable, you stick with the current element).