课程: Java Algorithms
今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
What is a stack?
- [Instructor] The stack data structure can be useful for algorithms where you need to keep track of state. A stack is an ordered series of objects, just like a list, but like a queue, the way we access, add, and remove items is a little different. When we work with the stack, we push objects on the top of the stack and pop objects off the stack. Items are added and removed from the same end. We add to the top and remove from the top. We say stacks follow a last-in, first-out policy, or a LIFO policy. If we add and remove from the same location, the last item pushed onto the stack will be the first item removed from the stack. Another way to think about this is that the first item pushed onto the stack will be the last item popped off. We can push as many items as we want onto a stack, but in order to retrieve a specific item further down the stack, we must pop off each item to get to it. Once all items have been popped off the stack, the stack is empty. One example of a stack is the…
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。
内容
-
-
-
-
-
-
(已锁定)
What is a queue?1 分钟 53 秒
-
(已锁定)
Standard queue operations in Java3 分钟 38 秒
-
(已锁定)
Queue algorithms: Generate binary numbers4 分钟 41 秒
-
(已锁定)
What is a stack?1 分钟 58 秒
-
(已锁定)
Basic stack operations in Java3 分钟 32 秒
-
(已锁定)
Stack algorithms: Theorizing an algorithm5 分钟 21 秒
-
(已锁定)
Stack algorithms: Next greater element3 分钟 57 秒
-
(已锁定)
Stack algorithms: Matching parentheses4 分钟 49 秒
-
(已锁定)
Solution: Evaluate reverse polish notation4 分钟 16 秒
-
(已锁定)
-
-
-