Input:
A, B, C, D, E ...
1/1
1/2
2/3
3/4
2/5
Output (Queue!):
5 B
1 E
3 C
4 D
2 A
How to make this?
Mark competitors (persons) Example: A ... E their come in first queue.
A can label/tag 1/1. B can label 1/2, consequently at this moment hierarchy B, A. Next C can label 2/3, consequently hierarchy B,C,A .
Then D can label 3/4, and hierarchy is B, C, D, A.
Finally can E label 2/5, which means, et finally hierarchy is B, E, C, D, A.
Using (linked list, queue, map?) Any ideas? How to solve this task?
Thanks.
My bad english!