Given N nodes on a 2-D plane represented as (xi, yi). The nodes are said to be connected if the manhattan distance between them is… Read More

# Category Archives: Advanced Data Structure

Given a graph with N nodes having values either P or M. Also given K pairs of integers as (x, y) representing the edges in… Read More

Given an array arr[] of length N, the task is to find the number of strictly increasing sub-sequences in the given array. Examples: Input: arr[]… Read More

Octree is a tree data structure in which each internal node can have at most 8 children. Like Binary tree which divides the space two… Read More

Given an array arr[] of size N and the task is to answer Q queries of the following types: 1 X 0: Append X at… Read More

Given a string S of length N and an integer K, the task is to find the length of longest sub-sequence such that the difference… Read More

Given a vertex V of an N-ary tree and an integer K, the task is to print the Kth ancestor of the given vertex in… Read More

Given an array arr[] of N elements and a number of queries where each query will contain three integers L, R, and K. For each… Read More

Given K vectors, the task is to design a cyclic iterator that prints the elements of these vectors in a cyclic manner. For example: v1… Read More

Given an integer N and an array seats[] where N is the number of people standing in a line to buy a movie ticket and… Read More

Consider an array A[] of integers and the following two types of queries. update(l, r, x): multiply x to all values from A[l] to A[r]… Read More

Given an array arr[], the task is to answer queries to find the maximum of all the elements in the index range arr[L…R].Examples: Input: arr[]… Read More