##
Maximize the sum of arr[i]*i
October 15, 2017

Given an array of N integers. You are allowed to rearrange the element of the array. The task is to find the maximum value of… Read More »

Quick Links for Sorting

Sorting Terminology |

Stability in sorting algorithms |

Time Complexities of all Sorting Algorithms |

External Sorting |

October 15, 2017

Given an array of N integers. You are allowed to rearrange the element of the array. The task is to find the maximum value of… Read More »

October 14, 2017

Given an array of n integers, We need to find all pairs with difference less than k Examples: Input : a[] = {1, 10, 4,… Read More »

October 11, 2017

You are given a rotated sorted array and your aim is to restore its original sort in place. Expected to use O(1) extra space and… Read More »

October 10, 2017

Circle sort algorithm can be visualized by drawing concentric circles on an array of integers. The elements of the array lying on the same circle… Read More »

October 4, 2017

A sorting algorithm is said to be stable if two objects with equal or same keys appear in the same order in sorted output as… Read More »

September 29, 2017

Given an array of positive integers. We are required to write a program to print the minimum product of any two numbers of the given… Read More »

Given a string of lowercase characters from ‘a’ – ‘z’. We need to write a program to print the characters of this string in sorted… Read More »

Given an array, find the difference between highest occurrence and least occurrence of any number in an array Examples: Input : arr[] = [7, 8,… Read More »

Consider an infinite x-y plane. Infinite people walk on the plane in upward or +ve Y direction. At each integer point on the x-axis, only… Read More »

September 26, 2017

Given a binary array, sort it using one traversal and no extra space. Examples: Input : 1 0 0 1 0 1 0 1 1… Read More »

September 21, 2017

Given an array with n distinct elements. An array is said to be almost sorted (non-decreasing) if any of its elements can occurs maximum of… Read More »

September 20, 2017

Given an array of n positive integers that represent lengths. Find out the maximum possible area whose four sides are picked from given array. Note… Read More »

Print the elements of an array in the decreasing frequency if 2 numbers have same frequency then print the one which came first. Examples: Input… Read More »

September 19, 2017

As we know, the single pivot quick sort takes a pivot from one of the ends of the array and partitioning the array, so that… Read More »

September 17, 2017

As we know, Mergesort is a divide and conquer algorithm that splits the array to halves recursively until it reaches an array of the size… Read More »