should be 25 |
我的方法是每次都分两组取最大最小 |
1. 3 balls take three times to get them in order from Heavy to Light. Say the order is 1, 2, 3 2. Now use the 4th ball to compare with 2, if it is heavier than 2, compare it with 1, otherwise compare it with 3. So it take 5 times to get 4 balls in order, say the order is 1, 2, 3, 4. 3. Now compare 5th ball with 2, and base on the results compare it with either 1 or 3, 4. It takes 8 times to get 5 balls in order. say the order is 1, 2, 3, 4, 5. 4. Compare 6th with 3 first and then compare it with either 1, 2 or 4, 5. It takes 3 more times to get 6th balls into the order. ... 1, 2, 3, 4, 5, 6, 7 Compare 8th ball with 4 first and then compare 8th ball with 2 or 6. Then compare 8th with the others based on the previous two comparison results. So it take 3 more time to get 8th in order. You can go on like this and get 25 times to make 10 balls in order. I think there should be a formula to calculate this. For example: Number of balls 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 Number of times 0 1 3 5 8 11 14 17 21 25 29 33 37 41 45 49 54 It add one more time once the number of balls is 2^n+1 and stays as that until it reaches 2^(n+1)+1. |
gurantee to get the balls in order. 9 times can not make sure the balls are in order. |
http://web.wenxuecity.com/BBSList.php?SubID=netiq&page=2 |
欢迎光临 珍珠湾ART (http://art.zhenzhubay.com/) | Powered by Discuz! X3 |