# Category Archives: Queue

Given a number n, write a function that generates and prints all binary numbers with decimal values from 1 to n.  Examples:  Input: n =… Read More
Priority Queue is an extension of queue with following properties. Every item has a priority associated with it. An element with high priority is dequeued… Read More
In the previous post, we introduced Queue and discussed array implementation. In this post, linked list implementation is discussed. The following two main operations must… Read More
Like Stack, Queue is a linear structure which follows a particular order in which the operations are performed. The order is First In First Out (FIFO).… Read More
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
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
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 deepest… Read More
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
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
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
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
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 a… Read More
Breadth First Traversal (or Search) for a graph is similar to Breadth First Traversal of a tree (See method 2 of this post). The… Read More
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