// Arup Guha
// 1/27/2024
// Test Code to illustrate Stack, Queue (via ArrayDeque), and PriorityQueue

import java.util.*;

public class moreds {

	public static void main(String[] args) {
	
		// Stack of dirty clothes!
		Stack<String> clothes = new Stack<String>();
		clothes.push("shirt");
		clothes.push("pants");
		clothes.push("hat");
		String clean = clothes.pop();
		System.out.println("clean "+clean);
		
		// Pop and clean.
		while (clothes.size() > 0) {
			String y = clothes.peek();
			System.out.println("top is "+y);
			clothes.pop();
			System.out.println("pop "+y);
		}
		
		// Regular Queue Test
		ArrayDeque<Integer> q = new ArrayDeque<Integer>();
		for (int i=0; i<10; i++)
			q.offer(i);
		
		for (int i=0; i<10; i++)
			System.out.println(q.poll());
		
		// Priority Queue - regular smallest pulled.
		System.out.println("Testing PQ regular");
		PriorityQueue<Integer> pq = new PriorityQueue<Integer>();
		Random r = new Random();
		for (int i=0; i<10; i++) {
			
			// Add 2.
			int a = r.nextInt(100);
			int b = r.nextInt(100);
			pq.offer(a);
			pq.offer(b);
			System.out.println("pq added "+a+" "+b);
			
			// Pull 1.
			int c = pq.poll();
			System.out.println("pq removed "+c);
		
		}
		
		System.out.println("Testing PQ big to small");
		
		// Priority Queue - regular biggest pulled.
		PriorityQueue<Integer> newpq = new PriorityQueue<Integer>(Comparator.reverseOrder());
		for (int i=0; i<10; i++) {
			
			// Add 2.
			int a = r.nextInt(100);
			int b = r.nextInt(100);
			newpq.offer(a);
			newpq.offer(b);
			System.out.println("pq added "+a+" "+b);
			
			// Pull 1.
			int c = newpq.poll();
			System.out.println("pq removed "+c);
		
		}
	}
}