Created
June 27, 2011 07:21
-
-
Save chaoxu/1048440 to your computer and use it in GitHub Desktop.
testing some data
This file contains 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
import Data.List | |
binaryArray n = a [] n | |
a list 0 = [list] | |
a list n = (a (0:list) (n-1))++(a (1:list) (n-1)) | |
f list = map (fx list) [1..length list] | |
fx list j = 1 + (length (takeWhile ((/=) (maximum result)) result)) | |
where result = map (sum . (take j) . (flip drop list)) [0..(length list)-j] | |
g n = length (map head ((group . sort) (map f (binaryArray n)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment