Binary Tree - 72: Convert Binary Tree to Doubly Linked List | Convert BST to DLL

Описание к видео Binary Tree - 72: Convert Binary Tree to Doubly Linked List | Convert BST to DLL

Source Code:https://thecodingsimplified.com/conve...
Solution:
We traverse the binary tree in inorder manner
We take a global variable 'prev' & 'headOfList'
Now whenever we're traversing any node, for 1st node after null, we assign headOfList to that node
After each iteration we update the prev to current node

Time Complexity: O(n)
Space Complexity: O(1)

Do Watch video for more info

CHECK OUT CODING SIMPLIFIED
   / codingsimplified  

★☆★ VIEW THE BLOG POST: ★☆★
http://thecodingsimplified.com

I started my YouTube channel, Coding Simplified, during Dec of 2015.
Since then, I've published over 200+ videos.

★☆★ SUBSCRIBE TO ME ON YOUTUBE: ★☆★
https://www.youtube.com/codingsimplif...

★☆★ Send us mail at: ★☆★
Email: [email protected]

Комментарии

Информация по комментариям в разработке