Can anyone tell me whats going wrong in my code?
Its running locally but won’t run in ide.
Also expected out is not matching for first node.
Double linked list
Sorry i forgot to include that, check for doubleLL function
Hello @sounakume,
It is working correctly:
https://ide.geeksforgeeks.org/Fg5nb79gab
What is the problem?
But the output is
1<–>2<–>3<–>5<–>6<–>7<–>8<–>
should not it be
2<–>1<–>3<–>5<–>6<–>7<–>8<–> ??
Nope @sounakume, it shouldn’t be what you have specified.
Reason:
It is a BST.
So, 2 is the right child of 1.
And as per your code,
- you will first go to the leftmost node i.e. 1 in this code
- Print it’s value.
- then go for the right child.
Hope, this would help.
Give a like if you are satisfied.
1 Like
yes yes i got it, the way im printing the tree got me confused.