Identify the time complexity of the following code as constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard. import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] wide = new int[n], sta = new int[n];
        HashMap<Integer, Integer> hm = new HashMap<Integer, Integer>();
        for (int i = 0; i < n; i++) {
        	wide[i] = sc.nextInt();
        	hm.put(wide[i], i + 1);
        }
        Util.sort(wide);
        sc.nextLine();
        String s = sc.nextLine();
        int tp = 0, pos = 0;
        StringBuilder out = new StringBuilder();
        for (int i = 0; i < s.length(); i++) {
        	int t;
        	if (s.charAt(i) == '0') {
        		t = wide[pos++];
        		sta[tp++] = t;
        	} else t = sta[--tp];
        	out.append(hm.get(t) + " ");
        }
        System.out.println(out.toString());
        sc.close();
    }
    public static class Util {
    	
    	public static <T extends Comparable<T> > void merge_sort(T[] a) {
    		Object[] aux = new Object[a.length];
    		merge_sort0(a, aux, 0, a.length);
    	}
    	
    	public static <T extends Comparable<T> > void merge_sort(T[] a, int l, int r) {
    		Object[] aux = new Object[a.length];
    		merge_sort0(a, aux, l, r);
    	}
    	
    	@SuppressWarnings("unchecked")
    	private static <T extends Comparable<T> > void merge_sort0(T[] a, Object[] temp, int l, int r) {
    		if (l + 1 == r) return;
    		int mid = (l + r) >> 1;
    		merge_sort0(a, temp, l, mid);
    		merge_sort0(a, temp, mid, r);
    		int x = l, y = mid, c = l;
    		while (x < mid || y < r) {
    			if (y == r || (x < mid && a[x].compareTo(a[y]) <= 0)) temp[c++] = a[x++];
    			else temp[c++] = a[y++];
    		}
    		for (int i = l; i < r; i++) a[i] = (T)temp[i];
    	}
    	
    	static final Random RAN = new Random();
    	
    	public static <T extends Comparable<T> > void quick_sort(T[] a) {
    		quick_sort0(a, 0, a.length);
    	}
    	
    	public static <T extends Comparable<T> > void quick_sort(T[] a, int l, int r) {
    		quick_sort0(a, l, r);
  ... Complexity: