print numbers without using loops

Java program to print counting without using loop

Print counting till n (40 in this case) without using loop Solution : Recursion public class PrintTillHundred { public static void main(String…s) { recurse(1); } public static void recurse(int i) { if(i>40) { System.out.println(“Number greater than 40, Program ending……….. “); return; } else { System.out.println(i);

Stack via LinkedList in java

Implementing Linked List based Stack in Java

Linked List based implementation of Stack in Java class Link { int value; Link next; Link(int val) { value = val; } } class StackLinkedList { static Link pfirst =null; public static void push( int val) { Link newLink = new Link(val); if(pfirst == null)

Linked List in Java

Singly Linked List in Java

Linked List in Java class Link { int key; int Data; Link next; //Constructor Link(int k, int d) { key = k; Data = d; } //overriding toString() method public String toString() { return “{ ” + Data + ” } “; } } public

Priority Queue in Java

Priority Queue in Java

Array based Priority Queue in java import java.util.Arrays; class Priorityy implements Comparable<Priorityy> { int size; static int front = 0; int rear = 0; static Priorityy[] arr = new Priorityy[3]; int key; String value; public Priorityy(int key, String value) { this.key = key; this.value =

doubly ended queue in java

Doubly Ended Queue in Java (array based DEQUEUE)

Array based doubly ended queue in java [DEQUEUE] import java.util.*; class doublyEndedQueue { static int b; static int a; static int max; static int[] arr; static int front = 0; static int rear = -1; public static void insertAtBegining(int element) { if(rear == max )

Circular Queue a in Java

Implement a Circular Queue in Java

Circular Queue a in Java also called Queue with wrap around import java.util.*; class QueueImplementation { static int front = 0; static int rear = -1 ; static int numelements = 0; static int arr []; static int max; static int value; public static void