Wednesday, January 11, 2012

Convert a Binary Tree / BST to a Doubly Link List

Question 1: Binary Tree to a Doubly Linked List.

http://www.geeksforgeeks.org/in-place-convert-a-given-binary-tree-to-doubly-linked-list/
http://www.geeksforgeeks.org/convert-a-given-binary-tree-to-doubly-linked-list-set-2/
http://www.geeksforgeeks.org/convert-given-binary-tree-doubly-linked-list-set-3/
http://www.geeksforgeeks.org/convert-a-given-binary-tree-to-doubly-linked-list-set-4/

Variation:
Given a Binary Tree, convert it to a Circular Doubly Linked List (In-Place).

The left and right pointers in nodes are to be used as previous and next pointers respectively in converted Circular Linked List.
The order of nodes in List must be same as Inorder of the given Binary Tree.
The first node of Inorder traversal must be head node of the Circular List.

http://www.geeksforgeeks.org/convert-a-binary-tree-to-a-circular-doubly-link-list/

Question 2: BST to doubly Linked List
http://sudhansu-codezone.blogspot.in/2012/01/binary-tree-to-circular-doubly-linked.html

1 comment:

  1. Same as Palindrome Linked List question except here we need not stop at the middle node in the recursion..

    ReplyDelete