Implementation of quickfind algorithm from sedgewick algorithms 4th edition notes.