Write an algorithm for Quick sorting