@@ -0,0 +1,1559 @@
+package Chapter01.Section01;%0A%0Aimport edu.princeton.cs.algs4.In;%0Aimport edu.princeton.cs.algs4.StdIn;%0Aimport edu.princeton.cs.algs4.StdOut;%0Aimport java.util.Arrays;%0A%0Apublic class Exercise23%0A%7B%0A    public static void main(String%5B%5D args)%0A    %7B%0A        int%5B%5D whitelist = In.readInts(args%5B0%5D);%0A        boolean ignoreWhiteListInputs = %0A            args.length == 1 %7C%7C args%5B1%5D.equals(%22+%22);%0A%0A        Arrays.sort(whitelist);%0A%0A        while (!StdIn.isEmpty())%0A        %7B%0A            int key = StdIn.readInt();%0A            int rank = rank(key, whitelist);%0A            if (rank %3C 0 && ignoreWhiteListInputs)%0A            %7B%0A                StdOut.println(key);%0A            %7D%0A            else if (rank %3E= 0 && !ignoreWhiteListInputs)%0A            %7B%0A                StdOut.println(key);%0A            %7D%0A        %7D%0A    %7D%0A%0A    public static int rank(int key, int%5B%5D a)%0A    %7B   return rank(key, a, 0, a.length - 1, 0);   %7D%0A%0A    public static int rank(int key, int%5B%5D a, int lo, int hi, int depth)%0A    %7B   // Index of key in a%5B%5D, if present, is not smaller than lo%0A        //                                  and not larger than hi%0A        String indents = %22%22;%0A        for(int i = 0; i %3C depth; i++)%0A        %7B%0A            indents = indents + %22  %22;%0A        %7D%0A%0A        System.out.println(indents + lo + %22 %22  + hi);%0A%0A        if (lo %3E hi) return -1;%0A        int mid = lo + (hi - lo) / 2;%0A        if      (key %3C a%5Bmid%5D) return rank(key, a, lo, mid - 1, depth + 1);%0A        else if (key %3E a%5Bmid%5D) return rank(key, a, mid + 1, hi, depth + 1);%0A        else                   return mid;%0A    %7D%0A%7D%0A

Solved 1.1.23