Given an unsorted array arr[] and an integer K, the task is to count the occurrences of K in the given array using Divide and… Read More

# Category Archives: Divide and Conquer

Given an unsorted array arr[] of length N, the task is to find the median of of this array. Median of a sorted array of size… Read More

Given an array arr[] of N integers, the task is to count the number of smaller elements on the right side for each of the… Read More

The Floyd-Rivest algorithm is a selection algorithm used to find the kth smallest element in an array of distinct elements. It is similar to the… Read More

The human brain can easily process visuals instead of long codes to understand the algorithms. In this article, a program that program visualizes the Merge… Read More

Given an array arr[] of N elements and an integer S. The task is to find the minimum number K such that the sum of… Read More

Given a linear board of length N numbered from 1 to N, the task is to find the expected number of moves required to reach… Read More

Given an array cell[] of N elements, which represent the positions of the cells in a prison. Also, given an integer P which is the… Read More

Given an infinite matrix filled with the natural numbers as shown below: 1 2 4 7 . . . 3 5 8 . . .… Read More

Given an array of size N containing numbers only from 0 to 63, and you are asked Q queries regarding it. Queries are as follows:… Read More

Given an array arr[], the task is to finds the total significant inversion count for the array. Two elements arr[i] and arr[j] form a significant… Read More

Given an integer N which is a multiple of 4, the task is to find an N x N grid for which the bitwise xor… Read More

Given four integers A, B, K, M. The task is to find (A + iB)K % M which is a complex number too. A +… Read More

The standard Tower of Hanoi problem is explained here . In the standard problem, all the disc transactions are considered identical. Given a 3×3 matrix… Read More