# Category Archives: Data Structures

This category is for logical grouping only. It needn’t to be added directly. Instead, the sub-categories should be added.

## Construct a sequence from given frequencies of N consecutive integers with unit adjacent difference

Given an array freq[] which stores the frequency of N integers from 0 to N – 1. The task is to construct a sequence where… Read More »

## Replace all occurrences of character X with character Y in given string

Given a string str and two characters X and Y, the task is to write a recursive function to replace all occurrences of character X… Read More »

## Minimum distance between any most frequent and least frequent element of an array

Given an integer array arr[] of size N, the task is to find the minimum distance between any most and least frequent element of the… Read More »

## Check if frequency of each element in given array is unique or not

Given an array arr[] of N positive integers where the integers are in the range from 1 to N, the task is to check whether… Read More »

## How to store a very large number of more than 100 digits in C++

Given an integer N in form of string str consisting of more than 100 digits, the task is to store the value for performing an… Read More »

## Generalized Fibonacci Numbers

We all know that Fibonacci numbers (Fn) is defined by the recurrence relation Fibonacci Numbers (Fn) = F(n-1) + F(n-2) with seed values F0 =… Read More »

## Java program to print all duplicate characters in a string

Given a string, the task is to write Java program to print all the duplicate characters with their frequency Example:  Input: str = “geeksforgeeks” Output:… Read More »

## Maximum value of Bitwise AND from root to leaf in a Binary tree

Given a Binary Tree, the task is to find the maximum value of Bitwise AND from any path from the root node to the leaf… Read More »

## Construct a string that has exactly K subsequences from given string

Given a string str and an integer K, the task is to find a string S such that it has exactly K subsequences of given… Read More »

## Count of all pairs in an Array with minimum absolute difference

Given an integer array arr[] of size N, the task is to count the total number of distinct pairs having minimum absolute difference. Examples:   Input: arr[]… Read More »

## Check if a large number is divisible by a number which is a power of 2

Given a large number in the form of a string str and a number K, the task is to check if the number formed by… Read More »

## Remove leading zeros from a Number given as a string

Given a numeric string str, the task is to remove all the leading zeros from a given string. If the string containing only zeros, then… Read More »

## Replace each element of Array with it’s corresponding rank

Given an array arr[] of N integers, the task is to replace each element of Array with their rank in array. The rank of an… Read More »

## Minimum cost to convert given string to consist of only vowels

Given string str of lower case alphabets, the task is to find the minimum cost to change the input string in a string that contains… Read More »

## Find pairs in array whose sum does not exist in Array

Given an array arr[] consisting of N positive integers, the task is to print all pairs of array elements whose sum does not exist in… Read More »