课程: Java Algorithms
今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Basic stack operations in Java
- [Instructor] Java has a built-in stack data structure that we can use in our custom algorithms. It lives in the java.util package. We can create a stack using the constructor. Like the other data structures, it's generic and this stack will hold strings. To add items to the stack, we'll use the push method. We'll also use function names to roughly emulate the run time stack. The run time stack uses objects with lots of information in them, but we'll just be pushing on strings. It all starts with the main method, then let's say a builder function is used, an external service might be called and once we get the response back, the execution for external service will be finished. So we'll pop that off the stack, then maybe we parse the response. That's another function call. Once that's finished, we'll pop it off. This will also conclude the builder's execution, so we'll pop off the builder and then finally the main method. With the stack, we can keep track of where each function was…
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。
内容
-
-
-
-
-
-
(已锁定)
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 秒
-
(已锁定)
-
-
-