二维若

BSTrootleafinsert.txt

Consider an initially empty BST and the sequence of values 1 2 3 4 5 6.

  1. Show the tree resulting from inserting these values "at the leaf". What is its height?
  2. Show the tree resulting from inserting these values "at the root". What is its height?
  3. Show the tree resulting from an alternate at-root-insertion and at-leaf-insertion, starting with at-the-leaf. What is its height?

说明:at the leaf:说明直接插入到 leaf 即可,不需要移动

at the root:说明需要调整到 root,但是一个一个调整

Splaying.txt

  1. Given an initially empty splay tree:
    • show the changes in the splay tree after each splay-insertion of the node values 5 3 8 7 4

  2. Given an initially empty splay tree:
    1. show the changes in the splay tree after each splay-insertion of the node values b c d e f g ...

    2. and then the splay tree after a search for node a ...

    3. and then the splay tree after a search for node d

说明:如果 search 不到元素,就将那个元素 splay,按照 zigzag 或者 zigzig 规则操作

猜你喜欢

转载自www.cnblogs.com/alex-bn-lee/p/11415291.html