MCPcopy Create free account
hub / github.com/apna-college/Alpha / reverse

Method reverse

13_Stacks/Question3.java:16–24  ·  view source on GitHub ↗
(Stack<Integer> s)

Source from the content-addressed store, hash-verified

14 }
15
16 public static void reverse(Stack<Integer> s) {
17 if(s.isEmpty()) {
18 return;
19 }
20
21 int top = s.pop();
22 reverse(s);
23 pushAtBottom(s, top);
24 }
25
26 public static void main(String args[]) {
27 Stack<Integer> stack = new Stack<>();

Callers

nothing calls this directly

Calls 3

pushAtBottomMethod · 0.95
isEmptyMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected