How to analyze the AVL Tree of binary search Tree in python
Today, I will talk to you about how to analyze the AVL tree of the binary search tree in python. Many people may not know much about it. In order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.
Recursive implementation of binary search Tree
Public void add (E e) {root = add (root,e);} / * binary search tree inserts elements recursively to implement * / private Node add (Node node, E) {if (node==null) {size++; return new Node (e) } if (e.compareTo (node.data) 0) {node.right = add (node.right,e);} return node;}
Recursive implementation of binary search tree search
Public boolean contains (E e) {return contains (root, e);} private boolean contains (Node node,E e) {if (node==null) {return false;} if (e.compareTo (node.data) = = 0) {return true;} else if (e.compareTo (node.data))