Data Structure tutorial (Java description) edited by Xu xiaokai-review abstract 05
Chapter 5 tree and binary tree
The nature of the tree:
1. The number of knots in the tree is equal to the number of all knots plus 1.
2. In the tree with a K Degree, at most K ^ (I-1) knots (I> = 1) on the I layer ).
3. K-tree H depth has at most (K ^ h-1)/(k-1) nodes.
4. The minimum depth of K-tree with N nodes is...
Binary Tree nature
1. The number of terminal knots on a binary tree is equal to the number of dual-branch knots plus 1.
2. Binary Tree on the I layer at most 2 ^ (I-1) nodes (I> = 1 ).
3. A binary tree with a depth of H has at most 2 ^ (h-1) nodes.
4. The depth of the Complete Binary Tree with N nodes is...
Link storage structure of Binary Trees
Node Type Definition
public class BTreeNode{Object element;BTreeNode left,right;public BTreeNode(Object obj) {element = obj;left =right=null;}public BTreeNode(Object obj,BTreeNode lt,BTreeNode rt){element = obj;left = lt;right = rt;}}
Binary Tree for Link Storage
Public class linkbinarytree implements binarytree {protected btreenode root; // defines the root pointer (reference) of the inherited Binary Tree public linkbinarytree () {root = NULL ;} // operate public btreenode getroot () {return root ;}...}
A queue is required for hierarchical traversal.
Implementation of link Storage Class of Binary Search Tree
public class linkBinarySearchTree extends linkBinaryTree implements BinarySearchTree{public linkBinarySearchTree(){super();}public Object find(final Object obj){}public Object update(final Object obj){}public boolean insert(final Object obj){}public boolean delete(final Object obj){}}
The heap is divided into a large heap and a small heap.
Public class sequenceheap implements heap {final int maxsize = 10; // array initial length private object [] heaparray; // array declaration private int length; // actual length of the current heap // Operation Public sequenceheap () {length = 0; heaparray = new object [maxsize];} public sequenceheap (int n) {}....}