## First strictly greater element in a sorted array in Java

Given a sorted array and a target value, find the first element that is strictly greater than given element. Examples: Input : arr[] = {1,… Read More »

## Modular exponentiation (Recursive)

Given three numbers a, b and c, we need to find (ab) % c Now why do “% c” after exponentiation, because ab will be… Read More »

## Java 8 | Arrays parallelSort() method with Examples

Java 8 introduced a new method called as parallelSort() in java.util.Arrays Class. It uses Parallel Sorting of array elements Algorithm of parallelSort() 1. The array… Read More »

## Search equal, bigger or smaller in a sorted array in Java

Given array of sorted integer, search key and search preferences find array position. A search preferences can be: 1) EQUAL – search only for equal… Read More »

## Merge Sort with O(1) extra space merge and O(n lg n) time

We have discussed Merge sort. How to modify the algorithm so that merge works in O(1) extra space and algorithm still works in O(n Log… Read More »

## Sudo Placement | Placement Tour

Given an array A of N positive integers and a budget B. Your task is to decide the maximum number of elements to be picked… Read More »

## Sudo Placement | Range Queries

Given Q queries, with each query consisting of two integers L and R, the task is to find the total numbers between L and R… Read More »

## Smallest number with given sum of digits and sum of square of digits

Given sum of digits and sum of square of digits . Find the smallest number with given sum of digits and sum of the square… Read More »

## Advanced master theorem for divide and conquer recurrences

Master Theorem is used to determine running time of algorithms (divide and conquer algorithms) in terms of asymptotic notations. Consider a problem that be solved… Read More »

## Distinct elements in subarray using Mo’s Algorithm

Given an array ‘a[]’ of size n and number of queries q. Each query can be represented by two integers l and r. Your task… Read More »

## Binary Search on Singly Linked List

Given a singly linked list and a key, find key using binary search approach. To perform a Binary search based on Divide and Conquer Algorithm,… Read More »

## Decrease and Conquer

As divide-and-conquer approach is already discussed, which include following steps: Divide the problem into a number of subproblems that are smaller instances of the same… Read More »

## Binary Search using pthread

Binary search is a popular method of searching in a sorted array or list. It simply divides the list into two halves and discard the… Read More »

## Numbers whose factorials end with n zeros

Given an integer n, we need to find the number of positive integers whose factorial ends with n zeros. Examples: Input : n = 1… Read More »

## Iterative Fast Fourier Transformation for polynomial multiplication

Given two polynomials, A(x) and B(x), find the product C(x) = A(x)*B(x). In the previous post we discussed the recursive approach to solve this problem… Read More »