Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App
geeksforgeeks
Browser
Continue

Related Articles

The Great Tree-List Recursion Problem.

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

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

My Personal Notes arrow_drop_up
Last Updated : 10 Jan, 2023
Like Article
Save Article
Similar Reads
Related Tutorials