Flattening the Tree into Double linked list

Problem Given the binary tree as shown below: Figure 1. Binary Tree Convert the tree into a double-linked list, where the left pointer and right pointer become the prev and next pointer respectively. Your algorithm should produce the double-linked list as below: