## LFU (Least Frequently Used) Cache Implementation

Least Frequently Used (LFU) is a caching algorithm in which the least frequently used cache block is removed whenever the cache is overflowed. In LFU… Read More »

Least Frequently Used (LFU) is a caching algorithm in which the least frequently used cache block is removed whenever the cache is overflowed. In LFU… Read More »

Given two arrays arr1[] and arr2[] sorted in ascending order and an integer K. The task is to find k pairs with smallest sums such… Read More »

Given a sequence of N elements, only three operations can be performed on any element at most one time. The operations are: Add one to… Read More »

Given K arrays of different size. The task is to check if there exist any two arrays which have the same sum of elements after… Read More »

Given N numbers which have a permutation of first N numbers. In a single operation, any prefix can be reversed. The task is to find… Read More »

How to apply STL binary_search to vector of pairs(key, value), given that vector is sorted by its first value(key) struct compare in the code contains… Read More »

Given a set S (all distinct elements) of integers, find the largest d such that a + b + c = d where a, b,… Read More »

Given an array of size N with repeated numbers, You Have to Find the top three repeated numbers. Note : If Number comes same number… Read More »

Assign value by a pair of {} to a container As we are familiar with the pair there is also one thing known as tuples.… Read More »

Given an array of N distinct element of at least size 2. A pair (a, b) in an array is defined as ‘a’ is the… Read More »

We are given two arrays. We need to sort one array according to another. Examples: Input : 2 1 5 4 9 3 6 7… Read More »

Operator overloading is one of the features of Object oriented programming which gives an extra ability to an operator to act on a User-defined operand(Objects).… Read More »

Map in STL is used to hash key and value. We generally see map being used for standard data types. We can also use map… Read More »

Given an array of integers, sort the array according to frequency of elements. If frequencies of two elements are same, print them in increasing order.… Read More »

The pair container is a simple container defined in <utility> header consisting of two data elements or objects. The first element is referenced as ‘first’… Read More »