2011年7月26日

经典抽象数据类型 堆栈(笔记)

摘要: 获取内存来存储值有三种方案:静态数组,动态分配的数组、动态分配的链式结构。用静态数组实现堆栈:#include "stack.h"#include <assert.h>#define STACK_SIZE 100static STACK_TYPE stack[STACK_SIZE];static int top_element = -1;void push (STACK_TYPE value){ assert(!is_full()); top_element += 1; stack[top_element] = value;}void pop(void){ as 阅读全文

posted @ 2011-07-26 16:27 dusts 阅读(422) 评论(0) 推荐(0)

导航