# Category Archives: Advanced Data Structure

## Score of Parentheses using Tree

Given a string str which contains pairs of balanced parentheses, the task is to calculate the score of the given string based on the given… Read More »

## Design a data structure that supports insert, delete, getRandom in O(1) with duplicates

Design a Data Structure that can support the following operations in O(1) Time Complexity. insert(x): Inserts x in the data structure. Returns True if x… Read More »

## Design a Queue data structure to get minimum or maximum in O(1) time

Problem: Design a Data Structure a SpecialQueue which supports following operations enque, deque, getMin() or getMax() where getMin() operation takes O(1) time. Example: Let the… Read More »

## Find just strictly greater element from first array for each element in second array

Given two arrays A[] and B[] containing N elements, the task is to find, for every element in the array B[], the element which is… Read More »

## Weak Heap

It is a binary tree that has following properties:- (1) Every key in the right sub-tree of a node is greater than the key stored… Read More »

## Array Range Queries to count Powerful numbers with updates

Given an array of N integers, the task is to perform the following two operations on the given array: query(L, R): Print the number of… Read More »

## Number of elements less than or equal to a number in a subarray : MO’s Algorithm

Given an array arr of size N and Q queries of the form L, R and X, the task is to print the number of… Read More »

## Static and Dynamic data structures in Java with Examples

Data structure is a way of storing and organising data efficiently such that the required operations on them can be performed efficiently with respect to… Read More »

## Count of elements in an Array whose set bits are in a multiple of K

Given an array arr[] of N elements and an integer K, the task is to count all the elements whose number of set bits is… Read More »

## Check if given words are present in a string

Given a big string and an array of small strings, all of which are smaller in length than the big string. The task is to… Read More »

## Queries for Count of divisors of product of an Array in given range | Set 2 (MO’s Algorithm)

Given an array arr of size N and Q queries of the form [L, R], the task is to find the number of divisors of… Read More »

## Queries for the count of even digit sum elements in the given range using Segment Tree.

Given an array arr[] of N elements, the task is to answer Q queries each having two integers L and R. For each query, the… Read More »

## Introduction to the Probabilistic Data Structure

Based on different properties such as speed, cost, and ease of use(as a developer), etc. the below information represents different ways of storing stuff in… Read More »

## XOR Queries on a given set

Given a set S with the initial element 0 that is S = { 0 }. The task is to perform each query when Q… Read More »

## Range Queries to find the Element having Maximum Digit Sum

Given an array Arr of N integers and Q queries, each query having a range from L to R. Find the element having maximum digit… Read More »