3 ms·
"invert a binary tree" This didn't make any sense to me, so I looked it up, and it seems exactly as senseless as I had thought. Is the 'inversion' not the same
by jl2718 4y ago
"invert a binary tree"
This didn't make any sense to me, so I looked it up, and it seems exactly as senseless as I had thought. Is the 'inversion' not the same topology as the input?
my solution: "auto invert(regular_tree x){return static-cast<inverted_tree>(x);}".
- devnullbrain 4y agoIt means swap the left and right pointers for each node.
- compressedgas 4y agoWhen I tried to find what was meant by "invert a binary tree", the only thing that made sense was the operation of reversing the tree: ((1 2) (3 4)) becomes ((4 3) (2 1))