Split the balls in 3 groups of 4 balls.
Weigh two of these groups. (2 w.)
Then take the two lightest from both tries and weigh them. The two lightest of these are sure the lightest of these 2 groups and you know their order. (1 w.)
Do the same with the two heaviest of both groups. You get the two heaviest of both groups in the correct order. (1 w.)
Weigh the remaining 4 and you have these 8 balls in the correct order. (1 w.)
Up to now we have 5 weighings.
Situation:
12 3 45 6 78 in correct order
ABCD unknown
Take the 3rd and the 6th of these 8 balls, add two of the remaining group (A B) and weigh them. Do the same with the other two of the remaining group (C D).
(2, altogether 7 weighings)
Now you know the place of A, B, C and D in relation to 3 and 6. W.l.o.g. there are 4 possible situations:
12&A - 3 - 45&B - 6 - 78&CD
12&AB - 3 - 45&CD - 6 - 78
12&AB&C - 3 - 45&D - 6 - 78
12&AB&CD - 3 - 45 - 6 - 78
1 to 8 in correct order
AB in correct order
CD in correct order
The groups (new groups, split by '-') in correct order, but inside the groups the order is unknown.
In the first case you simply weigh all groups (if there are only 3 in a group, you can add a random one), and you are done with 10 weighings.
In the second case you just need to weigh two groups, and you are done with 9 weighings.
In the 3rd case you weigh the second group and then 1ABC and, if necessary, 2ABC. You are done with 9 or 10 weighings.
In the 4th case you just have to order the first group. You start with weighing 12AB, then you weigh the lightest two of them together with CD. The lightest two of this weighing are the lightest two of the whole group, in correct order. Then weigh the remaining 4 (if necessary) and you are done with 10 (or 9) weighings.
Weigh two of these groups. (2 w.)
Then take the two lightest from both tries and weigh them. The two lightest of these are sure the lightest of these 2 groups and you know their order. (1 w.)
Do the same with the two heaviest of both groups. You get the two heaviest of both groups in the correct order. (1 w.)
Weigh the remaining 4 and you have these 8 balls in the correct order. (1 w.)
Up to now we have 5 weighings.
Situation:
12 3 45 6 78 in correct order
ABCD unknown
Take the 3rd and the 6th of these 8 balls, add two of the remaining group (A B) and weigh them. Do the same with the other two of the remaining group (C D).
(2, altogether 7 weighings)
Now you know the place of A, B, C and D in relation to 3 and 6. W.l.o.g. there are 4 possible situations:
12&A - 3 - 45&B - 6 - 78&CD
12&AB - 3 - 45&CD - 6 - 78
12&AB&C - 3 - 45&D - 6 - 78
12&AB&CD - 3 - 45 - 6 - 78
1 to 8 in correct order
AB in correct order
CD in correct order
The groups (new groups, split by '-') in correct order, but inside the groups the order is unknown.
In the first case you simply weigh all groups (if there are only 3 in a group, you can add a random one), and you are done with 10 weighings.
In the second case you just need to weigh two groups, and you are done with 9 weighings.
In the 3rd case you weigh the second group and then 1ABC and, if necessary, 2ABC. You are done with 9 or 10 weighings.
In the 4th case you just have to order the first group. You start with weighing 12AB, then you weigh the lightest two of them together with CD. The lightest two of this weighing are the lightest two of the whole group, in correct order. Then weigh the remaining 4 (if necessary) and you are done with 10 (or 9) weighings.