implementation & unit tests for quick sort