Nature and definition of the various tree 1

Degree: The number of children of a node, called a degree.

Root: As the name suggests, the root node is the top level of the tree, the other node by its "life." Multi-code represented by root.

Leaf node: tree leaves are most end position, so the meaning is of the leaf nodes of node 0.

Parent node: a node node.

Child nodes: next node node.

With full binary tree complete binary tree

1. Full Binary: either of the node is 0, or 2.

2. The complete binary tree: leaf node can only appear once on the bottom and lower.

3. binary search tree (binary search trees, binary sort tree, Binary Search Tree, BST): For any node, its left node to be smaller than it is. Its sequence preorder non-decreasing sequence. (It should be an example to add that he draw a map or something)

// Find the code binary sort tree
BTNode BSTSearch * (* BTNode the root, the DataType Item) { BTNode * P = the root; IF (the root == NULL) return NULL; // empty tree lookup fails the while (! P = NULL) { IF (p-Item ==> Data) return P; // find success IF (Item <p-> Data) P = p-> left; // Find in the left subtree of the else P = p-> right; // Find the right subtree } return NULL; // reach the end node lookup failed }

 

4.

Guess you like

Origin www.cnblogs.com/linyeming/p/11983486.html