Рет қаралды 7,638
Source Code: thecodingsimpl...
Solution
- We traverse the binary tree in inorder manner
- We take a global variable 'prev' & 'headOfList'
- We assign lowest node as headOfList. This is when prev is null.
- When prev is not null, then node.left = prev & prev.right = node
- After each iteration we update the prev to current node
Time Complexity: O(n)
Space Complexity: O(1)
For more info, please see the video.
CHECK OUT CODING SIMPLIFIED
/ codingsimplified
★☆★ VIEW THE BLOG POST: ★☆★
thecodingsimpli...
I started my KZbin channel, Coding Simplified, during Dec of 2015.
Since then, I've published over 500+ videos.
★☆★ SUBSCRIBE TO ME ON KZbin: ★☆★
www.youtube.co...
★☆★ Send us mail at: ★☆★
Email: thecodingsimplified@gmail.com