Write a function that prints out all of the elements in a binary tree in a very specific order. The order needs to start at the furthest depth and work its way up.
At the furthest depth/level, you need to print out all of the elements from most right node to most left node. At the second furthest depth/level the elements need to be
printed out from the most left node to the most right node. The 3rd furthest is right to left and the 4th furthest is left to right etc.
This repeats all the way up the tree.
For example, check out the attached png. There is an example binary tree which would have the following output:
"28,21,17,12,8,3,-2,-8,-5,5,15,25,20,0,10"
struct Node
{
Node* left;
Node* right;
int data;
}
void PrintTraversal(const Node& root)
{
//code goes here
};