Sort algorithm for evaluating binary selection

Provide a list of books that I want to order as much as I like. Instead of evaluating individual books, I select the best of two (randomly selected) books from the list and repeat this for as many pairs as possible (without evaluating all combinations).

How to sort a book list based on this binary selection? Does this problem have an official name?

+3
source share
3 answers

You can make Fisher-Yates shuffle from books, and then get them two by two. Comparison of only two instances is either stretching, which should be called sorting, or we can say that it is the very core.

0
source

Jonas Elfström , Fisher-Yates - , , , , . , , , , . , , , - , - , - . , , .

, , , , , A > B, B > C C > . , , . , .

, , - n x n, n - . i, j , i , j. i j .

PageRank, , , 1 . , , , a ij a ji, . , ,

   A B C
   _ _ _
 A|0 3 2
 B|2 0 3
 C|1 2 0

, a , B 3 , C 2 .

 A: (AB - BA) + (AC - CA) = (3 - 2) + (2 - 1) = 2
 B: (BA - AB) + (BC - CB) = (2 - 3) + (3 - 2) = 0
 C: (CA - AC) + (CB - BC) = (1 - 2) + (2 - 3) = -2

A > B > C.


, , , 0 . a B, , a, , B.

1 , , , .

+2

, , , .

, -. . , 10 14 ( ). 9 ( ).

, 20 ( ), , ( ).

, - ( , ).

, ( 1 , book2 book2 , book3, book1 , book3). - .

You can find both algorithms that are beautifully described on Wikipedia:
http://en.wikipedia.org/wiki/Insertion_sort
http://en.wikipedia.org/wiki/Quick_sort

0
source

Source: https://habr.com/ru/post/1783580/


All Articles