plz provide the detailed code for this problem and explaination as well including all possible cases as i am not able to understand it
Detect and break a loop in singly linked list
hi @S19LPPP020
which question you want to ask
you have tagged
binary-tree-to-doubly-linked-list-implementation
idea behind this problem is
1. If left subtree exists, process the left subtree
1.a) Recursively convert the left subtree to DLL.
…… 1.b) Then find inorder predecessor of root in left subtree (inorder predecessor is rightmost node in left subtree).
…… 1.c) Make inorder predecessor as previous of root and root as next of inorder predecessor.
2. If right subtree exists, process the right subtree (Below 3 steps are similar to left subtree).
…… 2.a) Recursively convert the right subtree to DLL.
…… 2.b) Then find inorder successor of root in right subtree (inorder successor is leftmost node in right subtree).
…… 2.c) Make inorder successor as next of root and root as previous of inorder successor.
3. Find the leftmost node and return it (the leftmost node is always head of converted DLL).
now try at you own with this approach
if find any problem you can ask
if this is not the question
please tagged correct question form next time
now you can ask