linked list and tree problems