p3(国外英语资料).docVIP

  • 12
  • 0
  • 约6.84千字
  • 约 23页
  • 2017-06-11 发布于河南
  • 举报
p3(国外英语资料)

p3(国外英语资料) * Source file name: P5.cpp Function: two fork tree operation * / #include iostream.h #include iomanip.h #include conio.h #include stdio.h #include process.h #include string.h #include math.h #include stdlib.h Struct BiTNode / / two tree node types { Int data; / / data Int TEM1, tem2; / / auxiliary data (without practice) BiTNode *left; / / pointer left sub tree BiTNode *right; / / pointer right subtree }; BiTNode *Tree; / / the two fork tree roots operation the program pointer Const max=100; Int elem[max]; / / storage of raw data BiTNode *stack[max]; / / number of the input and the random number seed from the keyboard, generate the specified number of elem in the array data, for the use of other programs, said 0 data ends Void init0 (int list[]); / / in position to generate text files of the program is Map.txt, which is displayed in Tree as the root pointer two fork tree Void showBinTree (BiTNode *Tree); / / number of the input and the random number seed from the keyboard, with Tree as the root pointer, generating the number of nodes in the binary tree two is specified, for other programs BiTNode, *init1 (); Void PreOrderTraverse (BiTNode *Tree); / / the first traversal of two binary tree, recursive algorithm Void MidOrderTraverse (BiTNode *Tree); / / two traversal of binary tree, recursive algorithm Void BackOrderTraverse (BiTNode *Tree); / / two after traversing binary tree, recursive algorithm Int LeafNum (BiTNode *Tree); / / statistics the number of leaf nodes Int BiTDepth (BiTNode *Tree); / / depth statistics two binary tree Int Max (int a, int b); / / return value Void insert (BiTNode *pRoot, BiTNode *pNode); / / pNode will be inserted into the tree node Void (BiOrderTree); / / generate two binary sort tree Void release (BiTNode *Tree); / / release tree Void ChangeLR (BiTNode *Tree); / / exchange of left and right subtree Void (searchBST); / / the two binary sort tree search node Void search (BiTNode, *Tree, int, a); Void (delBST); / / delete two bi

文档评论(0)

1亿VIP精品文档

相关文档