增加红黑树
This commit is contained in:
parent
c568d79eef
commit
78a081e8db
|
@ -5,7 +5,7 @@ module RedBlack =
|
|||
type Color = Red | Black
|
||||
|
||||
type RedBlackTree<'T> =
|
||||
| Node of Color * Left: 'T RedBlackTree * Value: 'T * Right: 'T RedBlackTree
|
||||
| Node of Color * Left: 'T RedBlackTree * Value: 'T * Right:'T RedBlackTree
|
||||
| Leaf
|
||||
|
||||
let balance = function
|
||||
|
@ -24,5 +24,5 @@ module RedBlack =
|
|||
elif y < x then balance (color, a, y, loop b)
|
||||
else s
|
||||
|
||||
loop s
|
||||
let (Node (_, a, b, c)) = loop s in Node (Black, a, b, c)
|
||||
|
Loading…
Reference in New Issue