princeton algorithm java implementation