Circular Queue

Circular Queue public class CircularQueue { private int[] a; private int start = -1; private int end = -1; private int startX = -1; private int endX = -1; private int size = 0; public…

Graph Using Adjacency Matrix

Adjacency Matrix import java.util.Scanner; public class AdjacencyMatrix { public static void main(String args[]) { Scanner scanner = new Scanner(System.in); int vertex[] = new int[scanner.nextInt()]; int edges[][] = new int[vertex.length][vertex.length]; for (int i = 0; i…

Stack Using Linked List

Stack Using Linked List package datastructure.algorithms.Stack; /** * * @author GOKUL */ public class StackUsingLinkedList { private Node head; public StackUsingLinkedList() { this.head=null; } public void push(int data) { head=new Node(data,head); } public int pop()…

Stack Using Array

Stack Using Array /** * * @author GOKUL */ public class StackUsingArray { private int[] array; private int size; private int top = -1; public StackUsingArray(int size) { this.size = size; array = new int[size];…

Dynamic Array

Dynamic Array class  package datastructure.algorithms.ArrayList; /** * * @author GOKUL */ public class ArrayList<T> { private Object[] array; private int size; private int index = -1; public ArrayList() { this.size = 5; array = new…