Data structures and sorting algorithms in Java