Default member function, depth, size, printing of the generalized table of "data structure"

Source: Internet
Author: User

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"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.