Moving tree to doubly linked list class to divide and conquer