Implement Deep Sort