Ch04-Trees课件.pptVIP

  • 5
  • 0
  • 约2.01万字
  • 约 49页
  • 2018-08-01 发布于江苏
  • 举报
§4 AVL Trees 〖Example〗 Input the months Mar Mar 0 ?1 May May 0 Nov Nov 0 ?1 ?2 May 0 ?1 Nov 0 0 ?2 ?1 Mar 0 0 0 ? The trouble maker Nov is in the right subtree’s right subtree of the trouble finder Mar. Hence it is called an RR rotation. In general: A ?1 B 0 BL BR AL RR Insertion RR Rotation A ?2 B ?1 BL BR AL BL B 0 A AL BR 0 A is not necessarily the root of the tree Single rotation §4 AVL Trees Aug May 0 ?1 Nov 0 0 ?2 ?1 Mar 0 1 1 Aug 0 Apr Apr 0 1 2 2 LL Rotation May 0 ?1 Nov 0 0 ?2 ?1 Aug 0 1 1 ?1 Mar 0 0 Apr 0 In general: A 1 B 0 BR BL AR LL Insertion A 2 B 1 BR BL AR LL Rotation B 0

文档评论(0)

1亿VIP精品文档

相关文档