• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests
March 22, 2024 |520 Views
PROBLEM OF THE DAY : 21/03/2024 | ZigZag Tree Traversal
Description
Discussion

Welcome to the daily solving of our PROBLEM OF THE DAY with Yash Dwivedi. We will discuss the entire problem step-by-step and work towards developing an optimized solution. This will not only help you brush up on your concepts of Tree but also build up problem-solving skills.

In this problem, we are given a binary tree with n nodes. Find the zig-zag level order traversal of the binary tree.

Example :

Input:
       1
     /   \
    2    3
   / \    /   \
  4   5 6   7
Output:
1 3 2 4 5 6 7

Give the problem a try before going through the video. All the best!!!
Problem Link: https://www.geeksforgeeks.org/problems/zigzag-tree-traversal/1
Solution IDE Link: https://ide.geeksforgeeks.org/online-cpp14-compiler/391b8771-5552-447a-b0d0-ddb131755827

Read More