【数据结构】之二叉树的java实现(2)
the size of the tree is 6 the height of the tree is 3 *******(前序遍历)[ABDECF]遍历***************** key:1--name:rootNode(A) key:2--name:B key:4--name:D key:5--name:E key:3--name:C key:6--name:F *******(中序遍历)[DBEACF]遍历***************** key:4--name:D key:2--name:B key:5--name:E key:1--name:rootNode(A) key:3--name:C key:6--name:F *******(后序遍历)[DEBFCA]遍历***************** key:4--name:D key:5--name:E key:2--name:B key:6--name:F key:3--name:C key:1--name:rootNode(A) ***非递归实现****(前序遍历)[ABDECF]遍历***************** key:1--name:rootNode(A) key:2--name:B key:4--name:D key:5--name:E key:3--name:C key:6--name:F ***非递归实现****(中序遍历)[DBEACF]遍历***************** key:4--name:D key:2--name:B key:5--name:E key:1--name:rootNode(A) key:3--name:C key:6--name:F ***非递归实现****(后序遍历)[DEBFCA]遍历***************** key:4--name:D key:5--name:E key:2--name:B key:6--name:F key:3--name:C key:1--name:rootNode(A) (编辑:ASP站长网) |