The code outputs the compete tree


Here is my code. It should print only rihgt view but its printing the complete tree

@tanjuljain19
your code is print the rightview alright
for input 1 2 -1 5 6 -1 -1 -1 3 -1 4 -1 -1
your code gives 1 3 4 5 hich is right

1 2 3 4 5 -1 6 -1 -1 -1 -1 -1 -1 for this custom input it should print 1 3 6 but it pritns the whole tree

@tanjuljain19
the tree you ve made is

so again ,ur code is correct