Print BST keys in the given range

how is this code not running?
This same code was compiled successfully in my terminal.

HI @mohitsethia it seems that you have shared the code for some other question.

@Ishitagambhir Here is the right code

@mohitsethia https://ide.codingblocks.com/s/215632 i have made some changes in how you’re taking input, its working now

1 Like

@Ishitagambhir Instead of taking an array, you directly took input and inserted them. How did this affect the code?

@mohitsethia i am not sure why the earlier way was giving a segmentation fault since you are not accessing the array out of bounds, but anyhow, you dont need the extra O(n) space when you can do the same job using O(1) space.