:;;;------------------------------------------------------------------------- :;;; Insertion. : :;; Starting point for the following tests. = ((((_ 110 _) 120 (_ 130 _)) 140 (_ 150 _)) 200 ((_ 310 _) 320 ((_ 330 _) 340 (_ 350 _)))) D! : :;; Counter-biased parent. ;; p - or + -> = ;; ( ) ;; n / \ ;; h + 1 h + 1 " 305k+ D! ) " 155k+ D! ) : :;; Cobiased parent, outer descendant. ;; p n ;; (- -) (=) ;; n / \ / \ p ;; (-) n ---> h + 1 (=) ;; / \ / \ ;; h + 1 h h h " 105k+ D! ) " 355k+ D! ) : :;; Cobiased parent, inner descendant. ;; p ;; (- -) c ;; n / \ (=) ;; (+) h n ,---' `---, p ;; / \ c ---> (*) (*) ;; h (*) / \ / \ ;; / \ h h h h ;; h h h - 1 h - 1 ;; h - 1 h - 1 " 125k+ D! ) " 135k+ D! ) " 110k- 130k- 150k- D! 135k+ D! ) " 335k+ D! ) " 325k+ D! ) " 350k- 330k- 310k- D! 325k+ D! ) : :;; Ascend tree. ;; p = -> - p = -> + ;; ( ) or ( ) ;; n / \ / \ n ;; h + 1 h h h + 1 " 125k+ 135k+ D! 105k+ D! ) " 325k+ 335k+ D! 355k+ D! ) : :;;;------------------------------------------------------------------------- :;;; Removal. : :;; Starting point for the following tests. = (((_ 110 (_ 120 _)) 130 ((_ 140 _) 150 _)) 200 ((_ 310 (_ 320 _)) 330 ((_ 340 _) 350 _))) D! : :;; Cobiased parent. ;; p p ;; (-) (=) ;; n / \ ---> n / \ ;; h h - 1 h - 1 h - 1 " 120k- D! 140k- D! ) " 340k- D! 320k- D! ) : :;; Balanced parent. ;; p p ;; (=) (+) ;; n / \ ---> n / \ ;; h h h - 1 h " 120k- 140k- D! 110k- D! ) " 320k- 340k- D! 350k- D! ) : :;; Counter-biased parent, balanced or counter-biased sibling. ;; p s ;; (+ +) (*) ;; / \ s p / \ ;; h - 1 (*) ---> (*) h ;; / \ / \ ;; h h h - 1 h ;; h - 1 h - 1 " 120k- 155k+ D! 110k- D! ) " 120k- 140k- 155k+ D! 110k- D! ) " 310k- 330k- 320k- D! 340k- D! ) : :;; Counter-biased parent, cobiased sibling. ;; p ;; (+ +) t ;; / \ s (=) ;; h - 1 (-) p ,---' `---, s ;; t / \ ---> (*) (*) ;; (*) h - 1 / \ / \ ;; / \ h - 1 h - 1 h - 1 h - 1 ;; h - 1 h - 1 h - 2 h - 2 ;; h - 2 h - 2 " 120k- D! 110k- D! ) " 155k+ 145k+ D! 120k- D! ) " 155k+ 135k+ D! 120k- D! ) " 340k- D! 350k- D! ) " D! 305k+ 325k+ D! 340k- D! ) " D! 305k+ 315k+ D! 340k- D! ) : :;;;------------------------------------------------------------------------- :;;; Joining. : :;; Splice, short counter-biased node. ;; n ;; n (+) ;; (-) / \ m ;; / \ ---> h (+) ;; h h - 1 / \ ;; h - 1 h =_ #14 14- D! ( #15-17 D! 14k ~ D! =_ #1-3 D! ( #17-4 4- D! 4k ~ D! : :;; Splice, standard balanced or counter-biased node. ;; n ;; n (*) ;; (*) / \ m ;; / \ ---> h (=) ;; h h h + 1 / \ ;; h + 1 h h =_ #15 D! ( #17-19 D! 16k ~ D! =_ #14 14- D! ( 15+ D! 14k ~ D! =_ #1-3 D! ( #19-5 D! 4k ~ D! =_ 1+ D! ( #15-2 2- D! 2k ~ D! : :;; Splice, cobiased node, balanced or counter-biased parent. ;; p ;; p (*) ;; (*) / \ m ;; / \ n h + 1 (-) ;; h + 1 (+) ---> h + 2 n / \ ;; h + 2 / \ (+) h ;; h - 1 h / \ ;; h - 1 h =_ #12 #14-17 13+ D! ( 19+ D! 18k ~ D! =_ #8 #10-16 14- 9+ D! ( 18+ D! 17k ~ D! =_ 1+ D! ( #19-7 #5-3 6+ D! 2k ~ D! =_ 1+ D! ( #18-11 #9-3 5- 10+ D! 2k ~ D! : :;; Splice, cobiased node, cobiased parent. ;; p n ;; (+) (=) ;; / \ n p / \ m ;; h (+) ---> (-) (=) ;; / \ / \ / \ ;; h - 1 h h h - 1 h h =_ #12 D! ( 14+ D! 13k ~ D! =_ 1+ D! ( #14-3 D! 2k ~ D! : :;; Ascent, cobiased node. ;; c ;; n (=) ;; (+) n / \ ;; / \ c ---> (=) h ;; h - 1 h / \ ;; h - 1 h - 1 =_ #13 D! ( 15+ D! 14k ~ D! =_ 1+ D! ( #15-3 D! 2k ~ D! : :;; Ascent, counter-biased node. ;; n ;; n (=) ;; (-) / \ c ;; / \ c ---> h + 1 (+) ;; h + 1 h / \ ;; h - 1 h =_ #8 #10-16 9+ D! ( 18+ D! 17k ~ D! =_ 1+ D! ( #18-11 #9-3 10+ D! 2k ~ D! : :;; Ascent, balanced node. ;; n ;; n (+) ;; (=) / \ c ;; / \ c ---> h (+) ;; h h / \ ;; h - 1 h =_ #15 D! ( 17+ D! 16k ~ D! =_ 1+ D! ( #3-17 D! 2k ~ D!