## Print all the pairs that contains the positive and negative values of an element

Given an array of distinct integers, print all the pairs having a positive value and negative value of a number that exists in the array.… Read More »

Quick Links for Sorting

Sorting Terminology |

Stability in sorting algorithms |

Time Complexities of all Sorting Algorithms |

External Sorting |

Given an array of distinct integers, print all the pairs having a positive value and negative value of a number that exists in the array.… Read More »

Given an array of integers, sort the first half of the array in ascending order and second half in descending order. Examples: Input : arr[]… Read More »

Prerequisites: Fenwick Tree (Binary Indexed Tree) Given an array of N numbers, and a number of queries where each query will contain three numbers(l, r… Read More »

Given an array with integer elements in small range, sort the array. We need to write a non-comparison based sorting algorithm with following assumptions about… Read More »

Given three numbers, how to sort them? Examples: Input : arr[] = {3, 2, 1} Output : arr[] = {1, 2, 3} Input : arr[]… Read More »

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 »

There are two in-built methods to sort in Java. Arrays.Sort() works for arrays which can be of primitive data type also. Output: Modified arr[] :… Read More »

In-place has more than one definitions. One strict definition is. An in-place algorithm is an algorithm that does not need an extra space and produces… Read More »

Given an array of distinct integers and a sum value. Print all triplets with sum smaller than given sum value. Expected Time Complexity is O(n2).… Read More »

Given a string of characters. The task is to write a program to print the characters of this string in sorted order using stack. Examples:… Read More »

Given an array of distinct integers and a range [a, b], the task is to count the number of triplets having a sum in the… Read More »

Consider a pipe of length L. The pipe has N water droplets at N different positions within it. Each water droplet is moving towards the… Read More »

Given two arrays A and B of same size N. Check whether array A can be fit into array B. An array is said to… Read More »

Unlike a set, a multiset may contain multiple occurrences of same number. The multiset equivalence problem states to check if two given multisets are equal… Read More »

Given an array of distinct elements. The task is to find triplets in array whose sum is equal to a given number. Examples : Input… Read More »