Write an efficient algorithm to invert alternate levels of a perfect binary tree. For example, consider below tree It should be converted to following tree: 1. Using Level Order Traversal The idea is to perform level order traversal of the perfect binary tree and traverse its nodes level-by-level. Then for each odd level, …
The post Invert alternate levels of a perfect binary tree appeared first on Techie Delight.