wwewbw

博客园 首页 新随笔 联系 订阅 管理

2010年2月9日 #

摘要: //栈空条件: this._size == -1//栈满条件: this.Count == this._array.Length//自己改了一下, this._size 直接指向栈顶元素using System;namespace Stack{ class Stack2 { //成员 private object[] _array; //存放元素的数组 private const int _def... 阅读全文
posted @ 2010-02-09 14:47 wwewbw 阅读(317) 评论(0) 推荐(0) 编辑

摘要: 引用自: [Michael McMillan.Data Structures and Algorithms Using C#]这里的实现是用ArrayList, 新数据项进栈的时候不需要担心调整表的大小. 我感觉这个实现比较清晰, 其中p_index直接指向栈顶元素.using System;using System.Collections;namespace Stack{ class CStac... 阅读全文
posted @ 2010-02-09 14:18 wwewbw 阅读(541) 评论(0) 推荐(0) 编辑

摘要: 引用自:[ 陈广.数据结构(C#语言描述)]栈空条件: this._size == 0栈满条件: this._size == this._array.Length非空栈中的栈顶指针始终在栈顶元素的下一个位置上.using System;namespace Stack{ class Stack { //成员 private object[] _array; //存放元素的数组 private con... 阅读全文
posted @ 2010-02-09 13:21 wwewbw 阅读(787) 评论(0) 推荐(0) 编辑