code cayton g quat

Download Code Cayton g Quat

If you can't read please download the document

Upload: hoang-quan

Post on 16-Aug-2015

225 views

Category:

Documents


6 download

DESCRIPTION

code cau truc cay tong quat

TRANSCRIPT

#include #include #define MaxLength 10#define NIL -1 typedef int Node;typedef char DataType;typedef struct Tree{ DataTypeData[MaxLength]; NodeParent[MaxLength]; int MaxNode;}; void MakeNullTree(Tree &T){T.MaxNode=0;}int EmptyTree (Tree T){return (T.MaxNode == 0);} Node Parent (Node n,Tree T){if(EmptyTree(T)||n>T.MaxNode-1)return NIL;elsereturn T.Parent[n];}DataType LabelNode(Node n, Tree T){if(!EmptyTree(T) && n