greedy sort using comparable obj