Sort 5 number - 拼圖

Poppy avatar
By Poppy
at 2011-01-13T09:35

Table of Contents

板上有點冷清,跟天氣一樣。

分享一題入門題,給大家動腦,高手可以跳過。


Just for fun。


有五個不相同的數字(未知,只能知道大小關係),

使用comparison的方法, (comparison = 拿兩個數字出來比大小,決定誰要放前面)

目標是使這五個數字按照大小排序。

請問你可以想出的方法,最多需要幾次comparison可達成。(越少越好)





補上英文題目。
how to sort 5 number with at most ## comparisons?

竟然過了一天沒人要回答...太簡單、題目看不懂還是太無聊@@?



--
Tags: 拼圖

All Comments

Olive avatar
By Olive
at 2011-01-16T12:03
4+3+2+1=10 泡泡排序XDDDD
Noah avatar
By Noah
at 2011-01-19T19:01
自己想的時候是8 偷偷去google發現還有7的做法…看完覺得想
出來的真的很神XD

Mimi puzzles讓我連續跑了玩反兩次

Daph Bay avatar
By Daph Bay
at 2011-01-09T19:13
今天想說真的想知道mimi puzzles的品質好不好 所以就先買了幾款魯班積木(木頭製)來試一下水溫 買了就現場找了個地方拆開玩了 當我拆開裡面結構的時候才發現 哇 帕索怎麼會錯過這個牌子的人間寶物阿 當場我就痛哭流涕阿六做的積木怎麼跟pentangle(英國)的品質有拼阿 當我手一直發抖拿著這79元的天 ...

猜數字要幾次才猜的到?

David avatar
By David
at 2011-01-09T17:57
Let n be a positive integer, and x an unknown non-negative integer less than n. Suppose you may ask questions of the form and#34;Is x less than t?and#34;, ...

ProjectEuler 319. Bounded Sequences

Lauren avatar
By Lauren
at 2011-01-09T07:33
319. Bounded Sequences http://projecteuler.net/index.php?section=problemsandamp;id=319 令 x_1, x_2, ..., x_n 是長度為 n 的數列,使得: * x_1 = 2 ; * 對所有 1<i≦n, x ...

屏風拼圖

Edward Lewis avatar
By Edward Lewis
at 2011-01-07T23:23
Pintoo去年底新推出的產品~~and#34;屏風拼圖and#34; 為雙面拼圖,質感不賴,值得收藏或送禮 不過~單價挺高的就是了~~要拿捏一下預算哦^^and#34; 清明上河圖總共有四幅(正反共8面) 目前完成三幅~~ 1. 462片清明上河圖:商店街 http://icecore.pixne ...

八卦板的「超怪面試問題」

Aaliyah avatar
By Aaliyah
at 2011-01-07T22:47
: 唔...這個結論似乎有待檢討 : 例如這樣好了: : case 1: case 2: : 正常一個 1g 正常一個 1.2g : 輕的一個 0.8g 輕的一個 0.4g : 四正常 4g 三正常一輕 4 ...