2011年4月26日
摘要: 代码如下:# include <stdio.h># include <stdlib.h>/*存储结构的定义*/struct ds_node { int data ; struct ds_node * next ;};/*入栈*/void ds_push(struct ds_node **top,int item) { struct ds_node * temp ; temp = (struct d... 阅读全文
posted @ 2011-04-26 20:03 codmer 阅读(437) 评论(0) 推荐(0) 编辑
摘要: 代码如下: 1: # include <stdio.h> 2: # include <stdlib.h> 3: 4: # define STACKSIZE 100 /* 栈的大小*/ 5: # define INCREMENTSIZE 10 /*栈的增量*/ 6: 7: /* 栈存储结构的定义 */ 8: struct ds_stack_tag { 9: int *base ; /*栈的起始地址*/ 10: int top ; /*指向栈顶*/ 11: int size ;/*栈大小*/ 12: }; 13: 14: /*初始化为栈分配存储空间*/ 15: void d 阅读全文
posted @ 2011-04-26 19:02 codmer 阅读(337) 评论(0) 推荐(0) 编辑
摘要: 链表、双链表、单循环链表、双循环链表 的实现代码都差不多,区别只是在对指针域的修改。下面,是对单循环链表的实现 1: # include <stdio.h> 2: # include <stdlib.h> 3: 4: /*存储结构的定义*/ 5: typedef struct node_tag { 6: int data ; 7: struct node_tag * next ; 8: }node; 9: 10: /************************************************************************/ 11: 阅读全文
posted @ 2011-04-26 14:30 codmer 阅读(1629) 评论(0) 推荐(0) 编辑