// Path: src/main/java/io/github/marioluan/datastructures/wrappers/Resizable.java
// public interface Resizable<T> {
// 
//     /**
//      * Resize the underlying object T holding the elements and returns a copy of
//      * it.
//      * <strong>Time complexity:</strong> O(n)<br>
//      * 
//      * @param a
//      *            the array to be resized
//      * @param n
//      *            the number of elements on the array
//      * @param capacity
//      *            the new capacity of the array
//      * @return the resized copy of a
//      */
//     T resize(T a, int n, int capacity);
// }


import java.util.Iterator;
import java.util.NoSuchElementException;
import edu.princeton.cs.algs4.StdRandom;
import io.github.marioluan.datastructures.wrappers.Resizable;
package io.github.marioluan.datastructures.queue;



/**
 * Randomized queue implementation using an array.
 * 
 * @author marioluan
 * @param <T>
 *            the class type of elements to be handled.
 */
public class RandomizedQueue<T> implements Iterable<T> {

    private T[]                  a;
    private int                  n;
// Path: src/main/java/io/github/marioluan/datastructures/wrappers/Resizable.java
// public interface Resizable<T> {
// 
//     /**
//      * Resize the underlying object T holding the elements and returns a copy of
//      * it.
//      * <strong>Time complexity:</strong> O(n)<br>
//      * 
//      * @param a
//      *            the array to be resized
//      * @param n
//      *            the number of elements on the array
//      * @param capacity
//      *            the new capacity of the array
//      * @return the resized copy of a
//      */
//     T resize(T a, int n, int capacity);
// }


// Path: src/main/java/io/github/marioluan/datastructures/queue/RandomizedQueue.java
import java.util.Iterator;
import java.util.NoSuchElementException;
import edu.princeton.cs.algs4.StdRandom;
import io.github.marioluan.datastructures.wrappers.Resizable;

package io.github.marioluan.datastructures.queue;



/**
 * Randomized queue implementation using an array.
 * 
 * @author marioluan
 * @param <T>
 *            the class type of elements to be handled.
 */
public class RandomizedQueue<T> implements Iterable<T> {

    private T[]                  a;
    private int                  n;
    private final Resizable<T[]> rs;