Types of data storage structures involved in structure

Source: Internet
Author: User

The big categories are:

Linear table, stack, queue, tree, binary tree, figure

Linear table:

Definition of sequential storage structure

typedef struct

{

Elemtype Data[maxsize]; Storing elements in a sequential table

int length; Length of the Storage order table

}sqlist; Type definitions for sequential tables

Definition of chained storage structure

typedef struct LNODE//define node types for single-linked lists

{

Elemtype data; Store element values

struct Lnode *next; Point to subsequent nodes

}linklist;

Stack:

Sequential storage structure of stacks

typedef struct

{

Elemtype Data[maxsize];

int top; Stack top pointer

}sqstack; Defining the sequential stack type

Chained storage structure for stacks

typedef struct LINKNODE

{

Elemtype data; Data fields

struct Linknode *next;//Pointer field

}lisyack; Define the link stack type

Queue:

Sequential storage structure of queues

typedef struct

{

Elemtype Data[maxsize]; Storing elements in a team

int front,near; Team head and end of team hands

}sqqueue; Defining the sequential stack type

Chained storage for queues

typedef struct

{

Elemtype data;

struct Qnode *next;

}qnode; Link team data node type definition

typedef struct

{

Qnode *front;

Qnode *rear;

}liqueue;//chain type definition

Tree:

Parent storage structure

typedef struct

{

Elemtype data; The value of the storage node

int parent; Where the parents are stored

}ptree[maxsize];

Child chain Storage structure

typedef struct NODE

{

Elemtype data; The value of the node

struct node *sons[maxsons]; Point to child node

}tsonnode;

Kid Brother Chained Storage structure

typedef struct TNODE

{

Elemtype data; The value of the node

struct Tnode *hp; Pointing Brother

struct Tnode *VP; Point to child node

}tsbnode;

Two-fork Tree:

Sequential storage structure

Defined as: typedef elemtype SQBTREE[MAXSIZE];

Chained storage structure

typedef struct NODE

{

Elemtype data; Data elements

struct node *lchild; Point to left child node

struct node *rchild; Point to right child node

}btnode;

Types of data storage structures involved in 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.