在列表树的落叶归我到目前为止这样的代码: data BinaryTree a = Null | Node a (BinaryTree a) (BinaryTree a)
treeLeaves :: BinaryTree a -> [a]
treeLeaves tree = case tree of
Null -> []
Node v t1 t2 -> [] ++ tr
我有一个树的节点有一个或两个孩子的数据结构。我可以生成具有给定最大深度的随机树。现在我想用给定的最大数量的节点(/ leafes)生成这三个随机数。这是我的结构: import System.Random
data Tree a = Leaf
| NodeTwo (Tree a) (Tree a)
| NodeOne (Tree a)
deriving
我被华金昆卡阿贝拉阅读this great article。他谈到使用红黑树实现一张表,而不是一个双向链表。 我有一些麻烦,理解如何,这可能涉及到发生着变化的缓冲区。例如,拿这两个缓冲器(原件,附加): Hello!\0 Original
y Append
而且我们说这块表看起来像这样: Hey!\0
: buffer start length
original 0 2
ori