Convert Binary Search Tree to Sorted Doubly Linked List | Using DFS Method | Leetcode 426 Solution

preview_player
Показать описание




.
.
.
Happy Programming !!! Pep it up 😍🤩
.
.
.
#pepcoding #code #coder #codinglife #programming #coding #java #freeresources #datastrucutres #pepcode #competitive #competitiveprogramming #softwareengineer #engineering #engineer
Рекомендации по теме
Комментарии
Автор

Thank you Sir!, this is the most favorite question asked in Facebook (San Francisco)!!

ankitagarwal
Автор

sir your concept and dry run are best on youtube. it would be great if you teach dynamic programic from basic to advanced.

soumya
Автор

Sir, i have done this question using temp head and temp tail pointers using inorder traversal

static Node th=null;
static Node tt=null;
public static void build(Node root){
if(root==null){
return;
}
//inorder traversal
build(root.left);

if(th==null){
// first node of the list
th=root;
tt=root;
}else{
//adding next nodes at the end and moving the tail node
root.left=tt;
tt.right=root;
tt=tt.right;
}

build(root.right);
}

public static Node bToDLL(Node root) {
build(root);

//circular
th.left=tt;
tt.right=th;
return th;
}

architsharma
visit shbcf.ru