Queue are a type of container adaptors which operate in a first in first out (FIFO) type of arrangement. Elements are inserted at the back… Read More

# Tag Archives: cpp-queue

Given a binary tree containing n nodes. The problem is to get the sum of all the leaf nodes which are at minimum level in… Read More

Given a Binary Tree, find the deepest leaf node that is left child of its parent. For example, consider the following tree. The deepest left… Read More

Queue are a type of container adaptors which operate in a first in first out (FIFO) type of arrangement. Elements are inserted at the back… Read More

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

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

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

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

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 the BST (Binary Search Tree) from its given level order traversal.Examples: Input : arr[] = {7, 4, 12, 3, 6, 8, 1, 5, 10}… Read More

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

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

Queues are a type of container adaptors which operate in a first in first out (FIFO) type of arrangement. Elements are inserted at the back… Read More

Given a binary tree, print level order traversal in a way that nodes of all levels are printed in separate lines.For example consider the… Read More

Given an array of non-negative integers. Find the largest multiple of 3 that can be formed from array elements. For example, if the input array is… Read More