Let's say I have this hierarchy:
0 King
1 Queen
2 Tower
3 Bishop
4 Knight
5 Pawn
and an array with this elements:
array = [Tower, Pawn, Bishop, Queen]
How can I sort it to become like this following the hierarchy?
array = [Queen, Tower, Bishop, Pawn]