Sort in Single Loop