Definition of a generalized table:
The generalized table is a nonlinear structure, and is a finite sequence of n elements.
Example: A= (A, B, (c,d))
Let's first define its structure:
(1) It has three kinds of nodes, head node, value node, child table node.
(2) Two pointers to the next node: pointer to _next node, pointer to child table node _sublink.
(3) _next and _sublink have only one
Enum type//defines three node types in generalized tables {head,//head type value,//value type sub,//sub-table type};struct generalizednode{type _type;//types by enumeration form generalizednode* _next;//Pointer to the next node union {int _value;//a node may be a value node or a child table node generalizednode* _SUBL Ink }; Generalizednode (Type type): _next (NULL), _type (type) {}};
This article is from the "C language 100-200 Prime" blog, please be sure to keep this source http://10740184.blog.51cto.com/10730184/1764567
Default member function, depth, size, printing of the generalized table of "data structure"