首页 > 其他 > 详细

Stack

时间:2015-10-25 06:11:06      阅读:271      评论:0      收藏:0      [点我收藏+]

Linear data structure.

First In Last Out.

push: O(1)  pop: O(1)  peek: O(1)

In Java, there is a Stack class.

A more complete and consistent set of LIFO stack operations is provided by the Deque interface and its implementations, which should be used in preference to this class. For example:
Deque<Integer> stack = new ArrayDeque<Integer>();

 

Implementation of Stack

1. Use array

2. Use linked list

 

Example:

Implement stack using queues

 

Stack

原文:http://www.cnblogs.com/ireneyanglan/p/4908015.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!