Skip to content

Category Archives: Queue

Priority Queue: Priority queue is the extension of the queue in which elements associated with priority and elements having higher priority is popped first. Priority… Read More
Given an array arr size N, the task is to print the final array value remaining in the array when the maximum and second maximum… Read More
Given a tree, our task is to check whether its left view is sorted or not. If it is then return true else false. Examples:  Input:  … Read More
Introduction : A Queue is a linear structure that follows a particular order in which the operations are performed. The order is First In First… Read More
Given a complete binary tree with N levels numbered [0, (N – 1 )] from root to the lowest level in decreasing order and having… Read More
Web Crawler is a bot that downloads the content from the internet and indexes it. The main purpose of this bot is to learn about… Read More
Given a queue Q containing N strings, the task is to restructure the queue to double its size such that the second half represents the… Read More
Problem: Design a Data Structure a SpecialQueue which supports following operations enqueue, deque, getMin() or getMax() where getMin() operation takes O(1) time.Example:   Let the data… Read More
Given an integer array A[] of length N and an integer K. The task is to find K distinct integral points that are not present… Read More
Given a matrix of size N x M consisting of integers 1, 2, 3 and 4. Each value represents the possible movement from that cell:  1… Read More
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
Introduction : In Java, a data structure is a way of organizing and storing data in memory. There are two types of data structures: static… Read More
Given N cities that are connected using N-1 roads. Between Cities [i, i+1], there exists an edge for all i from 1 to N-1.The task… Read More
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
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