MCPcopy Create free account
hub / github.com/careercup/ctci / main

Method main

java/Chapter 3/Question3_1/Question.java:11–22  ·  view source on GitHub ↗
(String [] args)

Source from the content-addressed store, hash-verified

9 // 3 stack pointers to keep track of the index of the top element
10 static int [] stackPointer = {-1, -1, -1};
11 public static void main(String [] args) throws Exception {
12 push(2, 4);
13 System.out.println("Peek 2: " + peek(2));
14 push(0, 3);
15 push(0, 7);
16 push(0, 5);
17 System.out.println("Peek 0: " + peek(0));
18 pop(0);
19 System.out.println("Peek 0: " + peek(0));
20 pop(0);
21 System.out.println("Peek 0: " + peek(0));
22 }
23
24 static void push(int stackNum, int value) throws Exception {
25 /* Check that we have space for the next element */

Callers

nothing calls this directly

Calls 3

pushMethod · 0.95
peekMethod · 0.95
popMethod · 0.95

Tested by

no test coverage detected