这个是不是等同于数据结构里的有5个数,用最坏的冒泡法(Bubble Sort)比较大小并排序的最坏的效率呢? 是不是n(n-1)/2次?也就是10次?(我认为的前提是如果5个顺序不排定,就没法找出第三个,可能我认为的这个前提也有误) |
先四个排序,最多6 次,设次序为A>B>C>D. 现在让剩下的E 和B 比较,如果E>B, 那么选B; 如果Ewww.ddhw.com |
Four comparisons to decide the largest one and the smallest one among four bottles, which sure can not be the answer. Then three comparisons to decide the middle one among the remaining three bottles. Do not know if it is the best. |
Deleting the smallest one among four bottles is a waste.
|
欢迎光临 珍珠湾ART (http://zzwav.com/) | Powered by Discuz! X3 |