package com.lxm.customDataStructure;

public class LinkStack<T>{
class Node<T>{
T data;
Node next;
Node(T data)
{
this.data=data;
this.next = null;
}
} Node<T> head; public LinkStack(T data)
{
this.head = null;
} public boolean isEmpty()
{
return this.head==null;
} public void push(T e)
{
Node temp = new Node(e);
temp.next = this.head;
this.head = temp;
} public T pop()
{
if(this.isEmpty()) return null;
Node temp = this.head;
this.head = temp.next;
return (T) temp.data;
} public static void main(String[] args)
{
LinkStack<Integer> S = new LinkStack<Integer>(0);
for(int i=0;i<10;i++)
{
S.push(i+1);
} while(S.isEmpty()==false)
{
System.out.print(S.pop()+"\t");
}
System.out.println();
}
}

最新文章

  1. tftp 限制ip 限制ip段 或者多个ip段访问
  2. 使用Apache Commons Configuration读取配置信息
  3. pgadmin中的备份功能消失的原因和找回方法
  4. MYSQL校对规则
  5. Android优化——UI优化(二) 使用include标签复用布局
  6. python string与list互转
  7. Unity GUI内绘制贝塞尔曲线
  8. List&lt;T&gt;Contains, Exists, Any之间的优缺点对比
  9. 在 Asp.NET MVC 中使用 SignalR 实现推送功能
  10. String 、InputStream、Reader 的转换
  11. 使用内核定时器的second字符设备驱动及测试代码
  12. LINQ 101——约束、投影、排序
  13. htm5 user-scalable 的意思
  14. Linux下一个patch补丁命令
  15. 黑科技--位集--bitset
  16. android 如何画心
  17. 注解式controller开发,action找不到controller???
  18. Linux下的压缩和解压缩命令gzip/gunzip
  19. hdu 1576 A/B 【扩展欧几里得】【逆元】
  20. sql(Oracle)优化之索引

热门文章

  1. [ jquery 过滤器 hasClass(class) ] 此方法用于在选择器的基础之上检查当前的元素是否含有某个特定的类,如果有,则返回true
  2. SQL性能优化案例分析
  3. 谈谈Fragment中的onActivityResult
  4. 通过jconsole监控tomcat JVM 内存、线程、CPU
  5. 错误解决:error while loading shared libraries: libcurl.so.4: cannot open shared object file: No such file or directory
  6. .net 已知图片的网络路径,通过浏览器下载图片
  7. C#:枚举
  8. .NET架构设计、框架设计系列文章总结
  9. 查看SQLserver编码格式的SQL语句
  10. fetch_20newsgroups 数据集导入失败: no handlers could be fetch_20newsgroups