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
Category Archives: Queue
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
Prerequisite : Priority Queue, Comparator Priority Queue is like a regular queue, but each element has a “priority” associated with it. In a priority queue,… Read More
Share a queue among three threads A, B, C as per given norms : Thread A generates random integers and pushes them into a shared… Read More
Given Nodes with their priority, implement a priority queue using doubly linked list. Prerequisite : Priority Queue push(): This function is used to insert a… Read More
Given a tree, print the level order traversal in sorted order. Examples : Input : 7 / \ 6 5 / \ / \ 4… Read More
Implement Priority Queue using Linked Lists. push(): This function is used to insert a new data into the queue. pop(): This function removes the element… Read More
A simple python List can act as queue and stack as well. Queue mechanism is used widely and for many purposes in daily life. A… Read More
Deque also known as double ended queue, as name suggests is a special kind of queue in which insertions and deletions can be done at the… Read More
Write a function to print ZigZag order traversal of a binary tree. For the below binary tree the zigzag order traversal will be 1 3… Read More
Deque or Double Ended Queue is a generalized version of Queue data structure that allows insert and delete at both ends. In previous post Implementation… Read More
I applied through an employee referral for SDET-1 position. I was interviewed at Amazon Chennai(SP Infocity).I faced 5 face to face rounds. On October 11th,… Read More
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