## Find next right node of a given key

Given a Binary tree and a key in the binary tree, find the node right to the given key. If there is no node on… Read More »

## Find the first non-repeating character from a stream of characters

Given a stream of characters, find the first non-repeating character from stream. You need to tell the first non-repeating character in O(1) time at any… Read More »

## Iterative Method to find Height of Binary Tree

There are two conventions to define the height of a Binary Tree 1) Number of nodes on the longest path from the root to the… Read More »

## Construct Complete Binary Tree from its Linked List Representation

Given Linked List Representation of Complete Binary Tree, construct the Binary tree. A complete binary tree can be represented in an array in the following… Read More »

## Find the first circular tour that visits all petrol pumps

Suppose there is a circle. There are n petrol pumps on that circle. You are given two sets of data. The amount of petrol that… Read More »

## Implement Stack using Queues

The problem is opposite of this post. We are given a Queue data structure that supports standard operations like enqueue() and dequeue(). We need to… Read More »

## Find the largest multiple of 3 | Set 1 (Using Queue)

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… Read More »

## LRU Cache Implementation

How to implement LRU caching scheme? What data structures should be used? We are given total possible page numbers that can be referred. We are… Read More »

## Check whether a given Binary Tree is Complete or not | Set 1 (Iterative Solution)

Given a Binary Tree, write a function to check whether the given Binary Tree is Complete Binary Tree or not. A complete binary tree is… Read More »

## Breadth First Search or BFS for a Graph

Breadth First Traversal (or Search) for a graph is similar to Breadth First Traversal of a tree (See method 2 of this post). The only… Read More »

## Sliding Window Maximum (Maximum of all subarrays of size k)

Given an array and an integer K, find the maximum for each and every contiguous subarray of size k. Examples : Input: arr[] = {1,… Read More »

## Applications of Queue Data Structure

Queue is used when things don’t have to be processed immediately, but have to be processed in First In First Out order like Breadth First… Read More »

## Queue using Stacks

The problem is opposite of this post. We are given a stack data structure with push and pop operations, the task is to implement a… Read More »

## Level order traversal in spiral form

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

## Level Order Tree Traversal

Level order traversal of a tree is breadth first traversal for the tree. Level order traversal of the above tree is 1 2 3 4… Read More »