随笔分类 - 树
红黑树、AVL树等实现
摘要:from collections import deque from dataStructures.tree.biTree.bst import BiTreeNode, BST class AVLNode(BiTreeNode): def __init__(self, data): BiTreeNo
阅读全文
摘要:''' 一、红黑树性质 结点必须是红色或者黑色。 根节点必须是黑色。 叶节点(NIL)必须是黑色(NIL节点无数据,是空节点)。 红色结点不能连续。 从任一节点出发到其每个叶子节点的路径,黑色节点的数量必须相等。 ''' from dataStructures.tree.biTree.bst imp
阅读全文