# The Great Tree-List Recursion Problem.

Asked by Varun Bhatia.

**Question:**

Write a recursive function treeToList(Node root) that takes an ordered binary tree and rearranges the internal pointers to make a circular doubly linked list out of the tree nodes. The”previous” pointers should be stored in the “small” field and the “next” pointers should be stored in the “large” field. The list should be arranged so that the nodes are in increasing order. Return the head pointer to the new list.

This is very well explained and implemented at: **Convert a Binary Tree to a Circular Doubly Link List**

**References:**

http://cslibrary.stanford.edu/109/TreeListRecursion.html

## Recommended Posts:

- DFS traversal of a tree using recursion
- Delete a linked list using recursion
- Preorder Traversal of N-ary Tree Without Recursion
- Zig-Zag traversal of a Binary Tree using Recursion
- Inorder Tree Traversal without Recursion
- Print root to leaf paths without using recursion
- Inorder Tree Traversal without recursion and without stack!
- Reverse a Doubly linked list using recursion
- Practice questions for Linked List and Recursion
- Delete nodes which have a greater value on right side using recursion
- Add the given digit to a number stored in a linked list using recursion
- Print alternate nodes of a linked list using recursion
- Write a program to Calculate Size of a tree | Recursion
- Postorder traversal of Binary Tree without recursion and without stack
- Remove duplicates from a sorted linked list using recursion