January 09, 2025 |11.6K Views

Reverse Level Order Traversal

  Share   Like
Description
Discussion

We have discussed the level order traversal of a tree. The idea is to print the last level first, then the second last level, and so on. Like Level order traversal, every level is printed from left to right.

We can easily modify the method 1 of the normal level order traversal. In method 1, we have a method printGivenLevel() which prints a given level number. The only thing we need to change is, instead of calling printGivenLevel() from the first level to the last level, we call it from the last level to the first level. 
 

Reverse Level Order Traversal: https://www.geeksforgeeks.org/reverse-level-order-traversal/