Given an array arr[] of size N and queries Q[][], the task is to perform the following types of queries on the given array. 0:… Read More
Category Archives: Queue
Given an undirected graph G, with V vertices and E edges, the task is to check whether the graph is 2-edge connected or not. A… Read More
Circular queue: Circular Queue is a linear data structure in which the operations are performed based on FIFO (First In First Out) principle and the… Read More
Given two integers R and C, denoting the number of rows and columns in a matrix, and two integers X and Y, the task is… Read More
Data Structure is the way of storing data in computer’s memory so that it can be used easily and efficiently. There are different data-structures used… Read More
Given an undirected graph of N nodes and M vertices. You are also given a K edges as selected[]. The task to maximize the shortest… Read More
Given a binary matrix mat[][], the task is to find the size of all possible non-empty connected cells. An empty cell is denoted by 0… Read More
Given N people standing in a queue and two arrays A[] and B[]. The array A[] represent the name of the person and array B[]… Read More
Given an undirected weighted graph of N nodes and M edges in the form of a tuple lets say {X, Y, Z} such that there… Read More
Given an initial array, A[] and a final array B[] both of size N containing integers from the range [1, N], where A[] represent the… Read More
C++ // C++ code #include <iostream> #include <utility> using namespace std; int main() { // Declaring the PAIR1 of int and char // IF… Read More
Array: An Array is a collection of items stored at contiguous memory locations. The idea is to store multiple items of the same type together.… Read More
Given array arr[] of positive integers, an integer Q, and arrays X[] and Y[] of size Q. For each element in arrays X[] and Y[],… Read More
Given two integers N and M, the task is to find out smallest number of operations required to convert N to M. Each operation involves… Read More
Given a graph G with V nodes and E edges, the task is to colour no more than floor(V/2) nodes such that every node has… Read More