随笔分类 -  数据结构

摘要:#include <stdio.h>#include <stdlib.h>#include <stdbool.h>typedef struct item{ int data;} Item;//节点结构 typedef struct node{ Item item; struct node *nextNode;}Node, *queue;//队列的链表结构 typedef struct { queue front; queue rear;} linkQueue;//初始化 void initQueue(linkQueue *q);//入队 void enQue 阅读全文
posted @ 2013-03-24 23:04 chapterlin 阅读(128) 评论(0) 推荐(0)
摘要:#include <stdlib.h>#include <stdbool.h>#include <stdio.h>#define MAXSIZE 20typedef struct { int date;} Item;typedef struct { Item item[MAXSIZE]; int front; //头指针 int rear; //尾指针 } queue;//初始化bool initQueue(queue *q);//入队 void EnQueue(queue *q, Item *e);//遍历void QueueTraverse(queue 阅读全文
posted @ 2013-03-21 16:21 chapterlin 阅读(143) 评论(0) 推荐(0)
摘要:#include <stdio.h>#include <stdlib.h>#include <stdbool.h>//数据 typedef struct item{ int index;} Item;//节点 typedef struct node{ Item item; struct node *next;} Node , *linkStackPtr; //栈 typedef struct{ linkStackPtr top; int count;} linkStack;//初始化void initLinkStack(linkStack *s);//进栈v 阅读全文
posted @ 2013-03-20 16:01 chapterlin 阅读(112) 评论(0) 推荐(0)
摘要:#include <stdio.h>#include <stdbool.h>#include <stdlib.h>#define MAXSIZE 20typedef struct item { int index;} Item;typedef struct stack { Item arr[MAXSIZE]; int index;} Stack ;//初始化栈 bool initStack(Stack *s);//入栈bool push(Stack *s, Item *e);//出栈void pop(Stack *s, Item *e); //依此显示栈中的 阅读全文
posted @ 2013-03-18 18:12 chapterlin 阅读(97) 评论(0) 推荐(0)
摘要:cpp] view plaincopy01.#define INITSIZE 100 //线性表的初始大小 02.#define INCREACEMENT 10 //定义线性表的分配容量 03. 04.struct List 05.{ 06. int * firstElement ; //首元素的地址 07. int length ; //现有元素个数 08. int allocate_size ; //当前的最大容量 09.}; 10. 11./* 初始化L ... 阅读全文
posted @ 2013-03-16 15:41 chapterlin 阅读(170) 评论(0) 推荐(0)
摘要:01.#include <stdio.h> 02.#include <stdbool.h> 03.#include <stdlib.h> 04.typedef struct ElementData 05.{ 06. int index; 07.} Item ; 08. 09.typedef struct node 10.{ 11. Item item; 12. struct node * nextNode; 13.} Node; 14. 15.typedef Node * linkList ; 16. 17.Node * CreateI... 阅读全文
posted @ 2013-03-16 15:40 chapterlin 阅读(111) 评论(0) 推荐(0)
摘要:01.#ifndef LIST_H_ 02.#define LIST_H_ 03.#include <stdbool.h> 04. 05.#define TSIZE 45 06. 07.struct film{ 08. char title[TSIZE]; 09. int rating; 10.}; 11. 12.typedef struct film Item; 13. 14.typedef struct node{ 15. Item item; 16. struct node * next; 17.} Node; 18. 19.t... 阅读全文
posted @ 2013-03-16 15:36 chapterlin 阅读(117) 评论(0) 推荐(0)