# Tag Archives: cpp-queue

## ZigZag Tree Traversal

Write a function to print ZigZag order traversal of a binary tree. For the below binary tree the zigzag order traversal will be 1 3… Read More »

## Number of visible boxes after putting one inside another

Given N boxes and their size in an array. You are allowed to keep a box inside another box only if the box in which… Read More »

## Iterative diagonal traversal of binary tree

Consider lines of slope -1 passing between nodes. Given a Binary Tree, print all diagonal elements in a binary tree belonging to same line. Input… Read More »

## Check if the given array can represent Level Order Traversal of Binary Search Tree

Given an array of size n. The problem is to check whether the given array can represent the level order traversal of a Binary Search… Read More »

## BFS using STL for competitive coding

A STL based simple implementation of BFS using queue and vector in STL. The adjacency list is represented using vectors of vector. In BFS, we… Read More »

## Construct BST from its given level order traversal

Construct the BST (Binary Search Tree) from its given level order traversal. Examples: Input : arr[] = {7, 4, 12, 3, 6, 8, 1, 5,… Read More »

## K-th ancestor of a node in Binary Tree

Given a binary tree in which nodes are numbered from 1 to n. Given a node and a positive integer K. We have to print… Read More »

## General Tree (Each node can have arbitrary number of children) Level Order Traversal

Given a generic tree, perform a Level order traversal and print all of its nodes Input : 10 / / \ \ 2 34 56… Read More »