# Category Archives: Queue

## Nth positive number whose absolute difference of adjacent digits is at most 1

Given a number N, the task is to find the Nth number which has an absolute difference of 1 between every pair of its adjacent… Read More »

## Static and Dynamic data structures in Java with Examples

Data structure is a way of storing and organising data efficiently such that the required operations on them can be performed efficiently with respect to… Read More »

## Implementing Water Supply Problem using Breadth First Search

Given N cities which are connected using N-1 roads. Between Cities [i, i+1], there exists an edge for all i from 1 to N-1. The… Read More »

## Diamond Tree

Given a number K, the task is to create the Diamond-like structure of Tree which follows these two conditions: First K levels of the tree… Read More »

## Print all Exponential Levels of a Binary Tree

Given a Binary Tree, the task is to print all the Exponential Levels in the given Binary Tree. An Exponential Level is a level whose… Read More »

## Print all K-sum levels in a Binary Tree

Given a Binary Tree and an integer K where the tree has positive and negative nodes, the task is to print the elements of the… Read More »

## Clockwise Triangular traversal of a Binary Tree

Given a Complete Binary Tree, the task is to print the elements in the Clockwise traversal order. Clockwise Traversal of a tree is defined as:… Read More »

## Print Nth Stepping or Autobiographical number

Given a natural number N, the task is to print the Nth Stepping or Autobiographical number. A number is called stepping number if all adjacent… Read More »

## Boundary Level order traversal of a Binary Tree

Given a Binary Tree, the task is to print all levels of this tree in Boundary Level order traversal. Boundary Level order traversal: In this… Read More »

## CPU Scheduling in Operating Systems using priority queue with gantt chart

Prerequisite: CPU Scheduling in Operating Systems Different Scheduling Algorithms: First Come First Serve CPU Scheduling: Simplest scheduling algorithm that schedules according to arrival times of… Read More »

## Check if cells numbered 1 to K in a grid can be connected after removal of atmost one blocked cell

Given a grid A of size N*M consisting of K cells denoted by values in range [1, K], some blocked cells denoted by -1 and… Read More »

## Minimum difference between maximum and minimum value of Array with given Operations

Given an array arr[] and an integer K. The following operations can be performed on any array element: Multiply the array element with K. If… Read More »

## Sum and product of K smallest and largest Fibonacci numbers in the array

Given an integer K and an array arr[] containing N integers, the task is to find the sum and product of K smallest and K… Read More »

## Minimize the maximum difference between adjacent elements in an array

Given a non-decreasing array arr[] and an integer K, the task is to remove K elements from the array such that maximum difference between adjacent… Read More »

## Print all Prime Levels of a Binary Tree

Given a Binary Tree, the task is to print all prime levels of this tree. Any level of a Binary tree is said to be… Read More »