## Priority Queue in Python

Priority Queue is an extension of the queue with following properties. 1) An element with high priority is dequeued before an element with low priority.… Read More »

## Find maximum vertical sum in binary tree

Given a binary tree, find the maximum vertical level sum in binary tree. Examples: Input : 3 / \ 4 6 / \ / \… Read More »

## Microsoft Interview experience | Set 178 (On-Campus Internship for IDC)

There were a total of 3 rounds. 1st was online coding, 2nd was written coding and last round was divided in three parts, basically 3… Read More »

## Sudo Placement[1.3] | Final Destination

Given an array of integers and a number K with initial and final values. Your task is to find the minimum number of steps required… Read More »

## Maximum length of rod for Q-th person

Given lengths of n rods in an array a[]. If any person picks any rod, half of the longest rod (or (max + 1) /… Read More »

## Level order traversal in spiral form | Using one stack and one queue

Write a function to print spiral order traversal of a tree. For below tree, function should print 1, 2, 3, 4, 5, 6, 7. You… Read More »

## Multi Source Shortest Path in Unweighted Graph

Suppose there are n towns connected by m bidirectional roads. There are s towns among them with a police station. We want to find out… Read More »

## Interleave the first half of the queue with second half

Given a queue of integers of even length, rearrange the elements by interleaving the first half of the queue with the second half of the… Read More »

## Check if a queue can be sorted into another queue using a stack

Given a Queue consisting of first n natural numbers (in random order). The task is to check whether the given Queue elements can be arranged… Read More »

## Reverse a path in BST using queue

Given a binary search tree and a key, your task to reverse path of the binary tree. Prerequisite : Reverse path of Binary tree Examples… Read More »

## Number of siblings of a given Node in n-ary Tree

Given an N-ary tree, find the number of siblings of given node x. Assume that x exists in the given n-ary tree. Example : Input… Read More »

## Level order traversal with direction change after every two levels

Given a binary tree, print the level order traversal in such a way that first two levels are printed from left to right, next two… Read More »

## Reversing a queue using recursion

Given a queue, write a recursive function to reverse it. Standard operations allowed : enqueue(x) : Add an item x to rear of queue. dequeue()… Read More »

## Smallest multiple of a given number made of digits 0 and 9 only

We are given an integer N. We need to write a program to find the least positive integer X made up of only digits 9’s… Read More »

## Sorting a Queue without extra space

Given a queue with random elements, we need to sort it. We are not allowed to use extra space. The operations allowed on queue are… Read More »