Tree to double-linked list conversion method