红黑树js
function RBTNode(value, parent) {
this.value = value;
this.parent = parent;
this.left = null;
this.right = null;
this.color = true;//默认插入的节点颜色为红色
}
// 辅助函数
// 使用boolean值作为颜色常量
const RED = true;
const BLACK = false;
//染色
const color = (node, col
原创
2021-04-30 17:51:19 ·
190 阅读 ·
1 评论