Program 1 : public class QueueUsingArray { private static final int queueCapacity = 20; int arr[] = new int[queueCapacity]; int size = 0; int top = -1; int rear = 0; public void pushinQueue(int pushedElement) { if (top < queueCapacity - 1) { top++; arr[top] = pushedElement; System.out.println(\"Element \" + pushedElement + \" is pushed to Queue !\"); display(); } else { System.out.println(\"Overflow !\"); } } public void pop() { if (top >= rear) { rear++; System.out.println(\"Pop operation done !\"); display(); } else { System.out.println(\"Underflow !\"); } } public void display() { if (top >= rear) { System.out.println(\"Elements in Queue : \"); for (int i = rear; i <= top; i++) { System.out.println(arr[i]); } } } public static void main(String[] args) { QueueUsingArray obj = new QueueUsingArray(); obj.pop(); obj.pushinQueue(20); obj.pushinQueue(18); obj.pushinQueue(67); obj.pushinQueue(343); obj.pop(); obj.pushinQueue(203); obj.pushinQueue(348); obj.pushinQueue(637); obj.pushinQueue(343); obj.pop(); obj.pop(); obj.pop(); } } Result 1 : 348 Element 637 is pushed to Queue ! Elements in Queue : 18 67 343 203 348 637 Element 343 is pushed to Queue ! Elements in Queue : 18 67 343 203 348 637 343 Pop operation done ! Elements in Queue : 67 343 203 348 637 343 Pop operation done ! Elements in Queue : 343 203 348 637 343 Pop operation done ! Elements in Queue : 203 348 637 343 Program 2: import java.util.Random; public class InsertionSort { public static void main(String str[]){ Random rand = new Random(); int arr[] = new int[20]; for(int i=0;i<20;i++){ arr[i]=rand.nextInt(100); System.out.print(arr[i]+\" \"); } System.out.println(\"\"); insertionSOrt(arr); for(int i=0;i<20;i++){ System.out.println(\"arr[\"+i+\"] : \"+arr[i]); } } public static void insertionSOrt(int arr[]){ for(int i=1;i=0 && temp Solution Program 1 : public class QueueUsingArray { private static final int queueCapacity = 20; int arr[] = new int[queueCapacity]; int size = 0; int top = -1; int rear = 0; public void pushinQueue(int pushedElement) { if (top < queueCapacity - 1) { top++; arr[top] = pushedElement; System.out.println(\"Element \" + pushedElement + \" is pushed to Queue !\"); display(); } else { System.out.println(\"Overflow !\"); } } public void pop() { if (top >= rear) { rear++; System.out.println(\"Pop operation done !\"); display(); } else { System.out.println(\"Underflow !\"); } } public void display() { if (top >= rear) { System.out.println(\"Elements in Queue : \"); for (int i = rear; i <= top; i++) { System.out.println(arr[i]); } } } public static void main(String[] args) { QueueUsingArray obj = new QueueUsingArray(); obj.pop(); obj.pushinQueue(20); obj.pushinQueue(18); obj.pushinQueue(67); obj.pushinQueue(343); obj.pop(); obj.pushinQueue(203); obj.pushinQueue(348); obj.pushinQueue(637); obj.pushinQueue(343); obj.pop(); obj.pop(); obj.pop(); } } Result 1 : 348 Element 637 is pushed to Queue ! Elements in Queue : 18 67 343 203 348 637 Element 343 is pushed to Que.