Asked by Varun Bhatia.
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
- Convert a Binary Tree to a Circular Doubly Link List
- Merge Sort for Doubly Linked List
- Convert a given Binary Tree to Doubly Linked List | Set 2
- Swap Kth node from beginning with Kth node from end in a Linked List
- QuickSort on Doubly Linked List
- Convert a given Binary Tree to Doubly Linked List | Set 1
- Merge two sorted linked lists
- Reverse a Doubly Linked List
- Check for Children Sum Property in a Binary Tree
- Level order traversal in spiral form
- Program to count leaf nodes in a binary tree
- Level Order Tree Traversal
- Clone a linked list with next and random pointer | Set 1
- Lowest Common Ancestor in a Binary Search Tree.
- Given a binary tree, print out all of its root-to-leaf paths one per line.