star

搜索

RSS

RSS Link

计数器

140165
表的3个例子
栈的头文件

数据结构头文件Ver2.0

Star posted @ 2010年10月05日 03:57 in C语言 with tags 数据结构 链表 队列 , 2181 阅读
/* 数据结构 全部结构定义文件 defs.h
 * author : star
 */

//引入所有需要的头文件 
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

//防止重复定义
#ifndef DEF_H
#define DEF_H

//定义执行状态返回结果
 
#define TRUE 		 1  //成功 
#define FALSE 		 0  //失败 

#ifndef FORMATSTR
#define FORMATSTR "%d " //输出格式 

typedef int ElemType;	//基本数据类型 
#endif

//线性表 
typedef struct
{
	ElemType *data;		//数据 
	int		 size;	    //容量 
	int 	 len;	    //长度 
}SQLIST;

//单链表
typedef struct link_node
{
	ElemType          data;		//数据
	struct link_node *next;		//结点 
}NODE, *NODEPTR, *LINKLIST;

//双向链表 
typedef struct dlink_node
{
	ElemType 		   data;			//数据 
	struct dlink_node *next, *prior;	//前后结点 
}DBNODE, *DBNODEPTR, *DBLINKLIST;

//循环单向链表 原理同单链表 
//循环双向链表 原理同双向链表

//静态链表
#define SLEN 512	//静态链表长度 
typedef struct slink_node
{
	ElemType data;	//数据 
	int      next;	//指针 
}SNODE, *SLINKLIST;

/*静态链表是给没有指针的语言写的,C语言有指针,*
 *而且静态链表不实用,定义多而杂,因此不写了   */
 
//广义表
enum{ATOM,LIST};
typedef struct glist_node
{
	int tag;			//ATOM或LIST 
	union
	{
		ElemType           data;	//ATOM 
		struct glist_node *head; 	//LIST 
	}item;
	struct glist_node *next;		//结点 
}GLNODE, *GLIST;

//顺序栈
typedef struct
{
	ElemType *data;		//数据 
	int 	  top;		//栈顶 
	int 	  size;		//容量 
}SQSTACK;

//链式栈
typedef struct stack_node
{
	ElemType 		   data;	//数据 
	struct stack_node *next;	//结点 
}LSNODE, *LSNODEPTR, *LINKSTACK;

//顺序循环队列
typedef struct
{
	ElemType  *data;	//数据 
	int front, rear;	//队首与队尾 
	int size;			//容量 
}SQQUEUE;

//链式队列
typedef struct queue_node	//结点 
{
	ElemType data;
	struct queue_node *next;
}LQNODE, *LQNODEPTR;

typedef struct
{
	LQNODEPTR front, rear;	//队首与队尾 
}LKQUEUE;

#endif
SCERT Haryana 3rd Cl 说:
2022年7月02日 18:46

State Council of Education Research & Training (SCERT) Haryana Redy to Prepare Elementary School Syllabus Academic year 2023, SCERT Haryana, Gurugram Organisation Owned by the Department of Elementary Education, Government of Haryana and helps to Organize the Public Examinations at Primary School Levels Annually in the State of Haryana Through the Affiliated Schools. SCERT Haryana 3rd Class Book SCERT Haryana Every year Conducted 1st, 2nd, 3rd, 4th, 5th Class Final Exam Month of April, This Exam Date Sheet Available at official Website, SCERT Haryana has Disclosed the 1st, 2nd, 3rd, 4th, 5th Class Syllabus for Board Exam 2023.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter