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

Method pushAtBottom

13_Stacks/Question3.java:5–14  ·  view source on GitHub ↗
(Stack<Integer> s, int data)

Source from the content-addressed store, hash-verified

3
4public class Question3 {
5 public static void pushAtBottom(Stack<Integer> s, int data) {
6 if(s.isEmpty()) {
7 s.push(data);
8 return;
9 }
10
11 int temp = s.pop();
12 pushAtBottom(s, data);
13 s.push(temp);
14 }
15
16 public static void reverse(Stack<Integer> s) {
17 if(s.isEmpty()) {

Callers 1

reverseMethod · 0.95

Calls 3

isEmptyMethod · 0.45
pushMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected