DSA 2018

Group A Group B Q.no 11 package folder2019; import java.util.Scanner; public class no11 { private int STACKSIZE; private Integer stack[]; no11(int STACKSIZE) { this.STACKSIZE = STACKSIZE; stack = new Integer[this.STACKSIZE]; } int TOP = -1; public void push(int data) { if (TOP == STACKSIZE – 1) { System.out.println(“Stack overflow”); } else { TOP++; stack[TOP] = […]

Continue Reading

DSA 2019 Makeup

Group B Q.No 11. package folder2019; import java.util.Scanner; class Stack { private java.util.LinkedList list = new java.util.LinkedList(); public Stack() { } public void clear() { list.clear(); } public boolean isEmpty() { return list.isEmpty(); } public void push(Object el) { list.addLast(el); } public Object pop() { if (isEmpty()) { System.out.println(“stack is empty”); } return list.removeLast(); } […]

Continue Reading

DSA 2019

Group B Q.No 11 package folder2019; import java.util.Scanner; public class no11 { private int STACKSIZE; private Integer stack[]; no11(int STACKSIZE) { this.STACKSIZE = STACKSIZE; stack = new Integer[this.STACKSIZE]; } int TOP = -1; public void push(int data) { if (TOP == STACKSIZE – 1) { System.out.println(“Stack overflow”); } else { TOP++; stack[TOP] = data; } […]

Continue Reading