Implement double linked list sort