25 is an upper bound on the number of weighings you need.
Fully ordering a pile of 5 stones takes 4 weighings (this is easy to prove but I can do so if necessary).
Fully ordering a pile of 5 stones can be done as follows:
a.) Assign each stone a number.
b.) Weigh stones 1, 2, and 3. Based on the results, renumber the stones so that 1 is the lightest, 2 is second, and 3 is the heaviest of the 3.
c.) Using the new numbers, weigh stones 3, 4, and 5. Based on the results, renumber them if necessary. If stone 3 remained stone 3, you are now done (2 weighings total). If not, stone 5 is at least guaranteed to be the heaviest stone overall.
d.) Again using the new numbers, weigh stones 2, 3, 4 and renumber if necessary. if no reordering was necessary, you are now done (3 weighings total). If not, stone 4 is at least guaranteed to be the second heaviest stone overall.
e.) Now that stones 4 and 5 are in the right place, weigh (using the new numbers) stones 1, 2, and 3 again. Renumber them based on the result, and now all 5 stones are guaranteed to be ordered correctly.
1.) Split the input stones into 3 piles of 5 stones (No weighings required)
2.) Order each of the 3 piles
(2-4 weighings each, 6-12 total weighings are required)
3.) While there are stones left in each pile (and more than 3 stones left total), weigh the heaviest stone from each pile. Put the heaviest one in the next available spot in the output area. This step will be repeated 12 times (then only 3 stones are left).
3.a) If you are lucky, all of the first 5 heaviest stones will come from the same sub pile (5 weighings done). The 6th heaviest stone is also now clear. You can now compare the 2 heaviest stones from the shorter pile with the single heaviest from the other pile. If you continue to be lucky, the 2 heaviest stones are both heavier than the heaviest from the other pile. Then you can put both into the output area at once. In this way, you can go from piles of 4-5 to 2-5 to 0-5, at which point you need no further weighings. This can skip step 4.
(7-12 weighings total)
4.) Weigh the last 3 stones, and put them in the correct order.
In the worst case this strategy requires 25 weighings. If you are given completely sorted input (or randomly generate the piles very luckily) step 2 will only take 6 weighings and step 3 will only take 7. Best case is 13 weighings, worst case is 25 under this strategy.