## Check the completeness of given binary tree | Set 2 – Using Level Order Traversal

Objective: Given a binary tree, write an algorithm to determine whether the tree is complete or not using Level order … Read more

## Breadth-First Search (BFS) in 2D Matrix/2D-Array

Objective: Given a two-dimensional array or matrix, Do the breadth-First Search (BFS) to print the elements of the given matrix. … Read more

## Breadth-First Search in Disconnected Graph

Objective: Given a disconnected graph, Write a program to do the BFS, Breadth-First Search or traversal. Example: Approach: Earlier we … Read more

## ZigZag OR Diagonal traversal in 2d array/Matrix using queue

Objective: Given a two-dimensional array or matrix, Write an algorithm to print the given matrix in a zigzag manner or … Read more

## Find the nearest building which has bike | Find nearest specific vertex from source in a graph.

Objective: Given a matrix (NxN) which represents the buildings in community. You are in a building and you need a … Read more

## Implement Queue Using Stacks

Objective: We know that Queue is FIFO (First-in-First-Out) and Stack is LIFO ( Last-in-First-Out). Here our objective is to implement … Read more

## Print The Top View of a Binary Tree

Objective: Given a binary tree, print it in the Top View of it.

What is Top View: Top view means when you look at the tree from the top the nodes you will see will be called the top view of the tree. See the example below.

as you can see in the example above,8, 4, 2, 1, 3, 7 is the Top view of the given binary tree.

Approach:

This approach is quite similar to the Print the Binary Tree in Vertical Order Path. Just modified the code so that it will print only the first element it will encounter in the vertical order.