| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 5194 人关注过本帖
标题:如何使用堆栈法???
只看楼主 加入收藏
yushengou
Rank: 1
等 级:新手上路
帖 子:401
专家分:0
注 册:2005-3-30
收藏
得分:0 
以下是引用leeteng在2005-4-12 19:27:52的发言: 晕,我都回过三次了,怎么每次都没有啊!! 是不是让我写一下实现代码?
我没学过数据结构,也没学过C++, JAVA只有上课睡觉的经历。 所以。。。。。想不出来

我是初学者,希望大家能多多帮助我 /bbs/showimg.asp?BoardID=34&filename=2005-4/200542294030151.gif" border="0" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://bbs./bbs/showimg.asp?BoardID=34&filename=2005-4/200542294030151.gif');}" onmousewheel="return imgzoom(this);" alt="" />
2005-04-13 08:53
幻风幻云
Rank: 1
等 级:新手上路
帖 子:762
专家分:0
注 册:2005-1-14
收藏
得分:0 
以下是引用shiuly在2005-4-12 20:41:17的发言: 好强,正在學習中.... 麻煩大哥們在偶學習的時候8要說魔獸啊 弄的俺也想去撕殺了
考验意志力的时候到了

2005-04-13 10:12
幻风幻云
Rank: 1
等 级:新手上路
帖 子:762
专家分:0
注 册:2005-1-14
收藏
得分:0 
以下是引用leeteng在2005-4-12 19:27:52的发言: 晕,我都回过三次了,怎么每次都没有啊!! 是不是让我写一下实现代码?
会了就写出来嘛 不知道你等什么

2005-04-13 10:13
yushengou
Rank: 1
等 级:新手上路
帖 子:401
专家分:0
注 册:2005-3-30
收藏
得分:0 
以下是引用幻风幻云在2005-4-13 10:13:58的发言: 会了就写出来嘛 不知道你等什么
好你在等我是不是要代码。 好像问了好几次,我每次都有说要的。 谢谢这位大哥可是我还是看不懂

[此贴子已经被作者于2005-4-13 10:56:38编辑过]


我是初学者,希望大家能多多帮助我 /bbs/showimg.asp?BoardID=34&filename=2005-4/200542294030151.gif" border="0" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://bbs./bbs/showimg.asp?BoardID=34&filename=2005-4/200542294030151.gif');}" onmousewheel="return imgzoom(this);" alt="" />
2005-04-13 10:47
angel_bear
Rank: 1
等 级:新手上路
帖 子:70
专家分:0
注 册:2005-4-12
收藏
得分:0 
2005-04-14 10:27
leeteng
Rank: 1
等 级:新手上路
帖 子:44
专家分:0
注 册:2005-1-7
收藏
得分:0 
堆栈类
punlic class StackClass{
private int stacktop;
private int[] list;
private int maxsize ;
public StackClass(){
maxsize = 100 ;
stacktop = 0 ;
list = new int[maxsize];
}
public StackClass(int stacksize){
if(stacksize <0){
Console.WriteLine("堆栈大小不能是负,默认100);
maxsize = 100;
}
else
maxsize = stacksize;
stacktop = 0 ;
list = new int[maxsize];
}
public bool Isempty{
get{
    return stacktop == 0;
}
}
public bool Isfull{
get{ return stacktop >= maxsize;}
}
public void Push(int num){
if(Isfull)
throw new StackOverFlowException():
else
list[stacktop] = num ;
stacktop ++ ;
}
public int Top(){
if(Isempty)
throw new StackUnderFlowException();
else
return list[stacktop-1];
}
public void Pop(){
if(Isempty)
throw new StackUnderFlowException();
else
stacktop --;
list[stacktop] = 0;
}
public void InitializeStack(){
for(int i = 0 ; i <stacktop ; i ++);
  list[i] = 0 ;
 stacktop= 0 ;
}
}
2005-04-14 15:00
快速回复:如何使用堆栈法???
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.015805 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved