if A is taller than B, but shorter than C. D is taller than B, but shorter than A. Print the persons in descending order of height. How can we solve this by code ?
I referred to Comparison-based ranking algorithm, Simple ranking algorithm
I understand that the ELO rating algorithm could help solve this problem. But ELO algoritm seems like doing over work for a much simpler problem. Is there any other well known algorithm for such kind of questions ?
Input :
AtB -> A is taller than B
AsC -> A is shorter than C
DtB -> D is taller than B
DsA -> D is shorter than A
Expected Output :
CADB