mirror of
https://github.com/krahets/hello-algo.git
synced 2025-07-06 14:27:26 +08:00
update stack and queue.
This commit is contained in:
@ -69,6 +69,10 @@ public class array_stack {
|
||||
int peek = stack.peek();
|
||||
System.out.println("栈顶元素 peek = " + peek);
|
||||
|
||||
/* 访问索引 index 处元素 */
|
||||
int num = stack.get(3);
|
||||
System.out.println("栈索引 3 处的元素为 num = " + num);
|
||||
|
||||
/* 元素出栈 */
|
||||
int pop = stack.pop();
|
||||
System.out.println("出栈元素 pop = " + pop + ",出栈后 stack = " + Arrays.toString(stack.toArray()));
|
||||
|
Reference in New Issue
Block a user