Polyphase
see Knuth Art of Computer Programming vol 3, Sorting and Searching.
Knuth don't do no Java, just pure algorithms, which are rarely more that 5 or 6 lines long and translate into any language usually no more than a page of code in any language.
Get the book from the library, any real library will have it, code it up, hand it in, get an A.
Enjoy!