增加红黑树

This commit is contained in:
Sanchime 2022-08-14 17:23:47 +08:00
parent c568d79eef
commit 78a081e8db
1 changed files with 2 additions and 2 deletions

View File

@ -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)