my code; https://ide.codingblocks.com/s/250804
I am not getting the expected output. How can i fix it?
my code; https://ide.codingblocks.com/s/250804
I am not getting the expected output. How can i fix it?
Hi Prince , the way you are trying to do is wrong it because you are incrementing the value of c after every node . I can give you a hint that try to make a level map i.e.
like this map<int,vector> LEVEL . After this find the level of each node and push it into the map like this.
LEVEL[current_node_level].push_back( Node_value).
After you are done doing this just traverse through the map and check if the key of the map is odd print the vector from end and vice versa .
Hope this helps.