Imperative quick-sort