- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
Red-Black Trees—Again rank(x) = # black pointers on path from x to an external node. Same as #black nodes (excluding x) from x to an external node. rank(external node) = 0. An Example Properties Of rank(x) for x an external node. rank(x) = 0 for x parent of external node. rank(x) = 1 p(x) exists = rank(x) = rank(p(x)) = rank(x) + 1. g(x) exists = rank(x) rank(g(x)). Red-Black Tree A binary search tree is a red-black tree iff integer ranks can be assigned to its nodes so as to satisfy the stated 4 properties of rank. Relationship Between rank() And Color (p(x),x) is a red pointer iff rank(x) = rank(p(x)). (p(x),x) is a black pointer iff rank(x) = rank(p(x)) – 1. Red node iff pointer from parent is red. Root is black. Other nodes are black iff pointer from parent is black. Given rank(root) and node/pointer colors, remaining ranks may be computed on way down. rank(root) Height = 2 * rank(root). No external nodes at levels 1, 2, …, rank(root). So, #nodes = S1 = i = rank(root) 2i -1 = 2 rank(root) – 1. So, rank(root) = log2(n+1). So, height(root) = 2log2(n+1). Join(S,m,B) Input Dictionary S of pairs with small keys. Dictionary B of pairs with big keys. An additional pair m. All keys in S are smaller than m.key. All keys in B are bigger than m.key. Output A dictionary that contains all pairs in S and B plus the pair m. Dictionaries S and B may be destroyed. Join Binary Search Trees O(1) time. Join Red-black Trees When rank(S) = rank(B), use binary search tree method. rank(S) rank(B) Follow right child pointers from root of S to first node x whose rank equals rank(B). rank(S) rank(B) If there are now 2 consecutive red pointers/nodes, perform bottom-up rebalancing beginning at m. O(rank(S) – rank(B)). rank(S) rank(B) Follow left child pointers from root of B to first node x whose rank equals rank(B). Similar to case when rank(S) rank(B). Split(k) Inverse of join. Obtain S … dictionary of pairs with key k. B … dictionary of pairs with key k. m … pair with key =
您可能关注的文档
最近下载
- 外教社新世纪英专本科生系列(修订版):英语阅读 第1册 PPT课件Unit 3.pptx VIP
- 毕业论文的选题及开题报告的撰写.pptx VIP
- 初中语文2025届中考常考易错字词汇总(多音字+形声字+易错字形+易错成语).pdf VIP
- 4清洁生产的实施途径.pptx VIP
- 中视科华有限公司北京技术服务分公司招聘笔试题库2025.pdf
- JJG 1201-2024 数字式轮胎压力表.pdf
- 高标准农田建设项目监理实施细则.docx
- 四川省成都市2022-2023学年八年级下册期末物理试卷3(含答案).pdf VIP
- 钩端螺旋体病疫情应急处置技术方案.doc VIP
- GB 24430.1-2009 家用双层床安全第1部分:要求.docx VIP
文档评论(0)