summaryrefslogtreecommitdiffstats
path: root/AufgabeFFP8.hs
diff options
context:
space:
mode:
authorMatthias Wisniowski <matthias.wisniowski@gmail.com>2012-05-30 10:54:45 +0200
committerMatthias Wisniowski <matthias.wisniowski@gmail.com>2012-05-30 10:54:45 +0200
commitbe645ea0de0d3a81d28c0b03644df7e5a100e7d2 (patch)
treeab6cee9fc1289f08e725f967fba5749b6a84c2df /AufgabeFFP8.hs
parent17e9463688dce3f5ee4e192ef3574925f13f8c36 (diff)
downloadffp-be645ea0de0d3a81d28c0b03644df7e5a100e7d2.tar.gz
ffp-be645ea0de0d3a81d28c0b03644df7e5a100e7d2.tar.bz2
ffp-be645ea0de0d3a81d28c0b03644df7e5a100e7d2.zip
Proper fix für 8.1, TestCasesHEADmaster
Diffstat (limited to 'AufgabeFFP8.hs')
-rw-r--r--AufgabeFFP8.hs35
1 files changed, 18 insertions, 17 deletions
diff --git a/AufgabeFFP8.hs b/AufgabeFFP8.hs
index d328ae8..fe9c894 100644
--- a/AufgabeFFP8.hs
+++ b/AufgabeFFP8.hs
@@ -96,26 +96,27 @@ divideAndConquer indiv solve divide combine initPb = dAC initPb
96 96
97-- minfree basic daq higher order 97-- minfree basic daq higher order
98 98
99b_indiv :: Int -> [Int] -> Bool 99minfree_bhof :: [Int] -> Int
100b_indiv l xs = length xs < l 100minfree_bhof xs = divideAndConquer b_indiv b_solve b_divide b_combine (False, xs)
101 101
102b_solve :: [Int] -> [Int] 102b_indiv :: (Bool, [Int]) -> Bool
103b_solve = id 103b_indiv (b, _) = b
104 104
105b_divide :: Int -> [Int] -> [[Int]] 105b_solve :: (Bool, [Int]) -> Int
106b_divide b xs = [us, vs] 106b_solve (_, xs) = head xs
107 where (us,vs) = partition (<b) xs 107
108 108
109b_combine :: Int -> [Int] -> [[Int]] -> [Int] 109
110b_combine b _ (us:vs:[]) = if (null ([0..b-1] \\ us)) 110b_divide :: (Bool, [Int]) -> [(Bool, [Int])]
111 then ([b..] \\ vs) 111b_divide (n, xs) = if (null ([0..b-1] \\ us))
112 else ([0..] \\ us) 112 then [(True, [b..] \\ vs)]
113 113 else [(True, [0..] \\ us)]
114minfree_bhof :: [Int] -> Int 114 where
115minfree_bhof [] = 0 115 (us, vs) = partition (<b) xs
116minfree_bhof xs = head $ divideAndConquer (b_indiv (length xs)) b_solve (b_divide b) (b_combine b) xs 116 b = 1 + (length xs) `div` 2
117 where b = 1+(length xs) `div` 2
118 117
118b_combine :: (Bool, [Int]) -> [Int] -> Int
119b_combine xs sols = head sols
119 120
120-- minfree refined daq higher order 121-- minfree refined daq higher order
121 122