BST to Circular Doubly Linked List

Inorder pointer-rewiring visualizer (LeetCode 426)

Read Here
Step0/35
Linked0
DLL Order[]
Back To Trees List

Python Code

14 def inorder(node):
15 nonlocal head, prev
16 if node is None:
return
18 inorder(node.left)
19 if prev is None:
20 head = node
21 else:
22 prev.right = node
23 node.left = prev
24 prev = node
25 inorder(node.right)
26
27 inorder(root)
Current Line (17): Inorder Function Entry

Tree Structure

1234567
Operation:ENTER:

DLL Build Progress

Current Node

-

Operation

Enter Function

Result Array

DLL order appears here...
Step 1: ENTER:

Recursion Stack

Stack is empty. Click Next to begin!

Step Explanation

Ready to Start

Click "Next Step" to begin. We will run inorder DFS and rewire pointers into a circular DLL.

  • > Track head and prev updates at every visit.
  • > Watch call stack, highlighted line, and DLL order together.
Unvisited
Left
Current
Right
Done