001package algs21; 002import stdlib.*; 003import algs12.XCard; 004 005public class XSortCards1 { 006 public static void show (String title, XCard[] d) { 007 StdOut.println (title); 008 for (int i=0; i<4; i++) { 009 for (int j=0; j<13; j++) { 010 StdOut.format ("%3s ", d[i*13+j]); 011 } 012 StdOut.println (); 013 } 014 StdOut.println (); 015 } 016 public static void main (String[] args) { 017 XCard[] d = XCard.newDeck (); 018 show ("Initial", d); 019 StdRandom.shuffle (d); 020 show ("Shuffled", d); 021 Insertion.sort (d); 022 show ("Sorted", d); 023 } 024}