Quick sorting and selecting and three waying.