This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data Flag = Live | Dead | |
type OrderedBoard = [Flag] | |
gen :: Int -> [(Int, Int)] -> OrderedBoard | |
gen sidelen pos = map (\(n, _) -> bool_to_flag (elem (n `div` sidelen, n `rem` sidelen) pos)) (zip [0,1..(sidelen^2-1)] (replicate (sidelen^2) Dead)) | |
bool_to_flag :: Bool -> Flag |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[10/07/14 15:51:49] qnighy/Acike: 最も有名な優先順位つきキューの実装は | |
[10/07/14 15:51:55] qnighy/Acike: 2分ヒープによるもので | |
[10/07/14 15:52:15] qnighy/Acike: 完全2分木の配列表現を用いる | |
[10/07/14 15:52:23] qnighy/Acike: 完全2分木の配列表現というのは、 | |
[10/07/14 15:52:38] qnighy/Acike: まず、0番目の要素は使わない(ダミーとして使うなど)。 | |
[10/07/14 15:52:43] qnighy/Acike: 根は1番目。 | |
[10/07/14 15:52:59] qnighy/Acike: ある頂点nの親はn/2(切り捨て)。 | |
[10/07/14 15:53:09] qnighy/Acike: ある頂点nの子はn*2とn*2+1。 | |
[10/07/14 15:53:33] qnighy/Acike: で、完全二分木がヒープ条件を満たすとは | |
[10/07/14 15:53:49] qnighy/Acike: 根以外のどの頂点についても、その頂点より親のほうが大きい |
OlderNewer