## Sort linked list which is already sorted on absolute values

Given a linked list which is sorted based on absolute values. Sort the list based on actual values. Examples: Input : 1 -> -10 output:… Read More »

## Merge two sorted arrays with O(1) extra space

We are given two sorted array. We need to merge these two arrays such that the initial numbers (after complete sorting) are in the first… Read More »

## Time complexity of insertion sort when there are O(n) inversions?

What is an inversion? Given an array arr[], a pair arr[i] and arr[j] forms an inversion if arr[i] < arr[j] and i > j. For… Read More »

## Sort an array according to the order defined by another array

Given two arrays A1[] and A2[], sort A1 in such a way that the relative order among the elements will be same as those are… Read More »

## C Program for Binary Insertion Sort

We can use binary search to reduce the number of comparisons in normal insertion sort. Binary Insertion Sort find use binary search to find the… Read More »

## Java Program for Binary Insertion Sort

We can use binary search to reduce the number of comparisons in normal insertion sort. Binary Insertion Sort find use binary search to find the… Read More »

## Python Program for Binary Insertion Sort

We can use binary search to reduce the number of comparisons in normal insertion sort. Binary Insertion Sort find use binary search to find the… Read More »

## Sort a nearly sorted (or K sorted) array

Given an array of n elements, where each element is at most k away from its target position, devise an algorithm that sorts in O(n… Read More »

## Given a linked list which is sorted, how will you insert in sorted way

Given a sorted linked list and a value to insert, write a function to insert the value in a sorted way. Initial Linked List Linked… Read More »