## Stable QuickSort

A sorting algorithm is said to be stable if it maintains the relative order of records in the case of equality of keys. Input :… Read More »

## Quick Sort vs Merge Sort

Prerequisite :Merge Sort and Quick Sort Quick sort is an internal algorithm which is based on divide and conquer strategy. In this: The array of… Read More »

## Generic Implementation of QuickSort Algorithm in C

Write a function to implement quicksort algorithm that will work for all types of data i.e ints, floats, chars etc. It should accept all types… Read More »

## Segregate even and odd numbers | Set 3

Given an array of integers, segregate even and odd numbers in the array. All the even numbers should be present first, and then the odd… Read More »

## Comparisons involved in Modified Quicksort Using Merge Sort Tree

In QuickSort, ideal situation is when median is always chosen as pivot as this results in minimum time. In this article, Merge Sort Tree is… Read More »

## Quickselect Algorithm

Quickselect is a selection algorithm to find the k-th smallest element in an unordered list. It is related to the quick sort sorting algorithm. Examples:… Read More »

## Dual pivot Quicksort

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 »

## Positive elements at even and negative at odd positions (Relative order not maintained)

You have been given an array and you have to make a program to convert that array such that positive elements occur at even numbered… Read More »

## Move all negative numbers to beginning and positive to end with constant extra space

An array contains both positive and negative numbers in random order. Rearrange the array elements so that all negative numbers appear before all positive numbers.… Read More »

## Why quicksort is better than mergesort ?

This a common question asked in DS interviews that despite of better worst case performance of merge sort, quicksort is considered better than mergesort. There… Read More »

## Hoare’s vs Lomuto partition scheme in QuickSort

We have discussed implementation of QuickSort using Lomuto partition scheme. Lomuto’s partition scheme is easy to implement as compare to Hoare scheme. Lomuto’s Partition Scheme… Read More »

## Know Your Sorting Algorithm | Set 2 (Introsort- C++’s Sorting Weapon)

We have discussed sorting weapons used by different languages in previous article. In this article, C++’s Sorting Weapon, Introsort is discussed. What is Introsort? Simply… Read More »

## Know Your Sorting Algorithm | Set 1 (Sorting Weapons used by Programming Languages)

Ever wondered how sort() function we use in C++/Java or sorted() in Python work internally? Here is a list of all the inbuilt sorting algorithms… Read More »

## C qsort() vs C++ sort()

Standard C library provides qsort function that can be used for sorting an array. Following is the prototype of qsort() function. // Sort an array… Read More »

## QuickSort Tail Call Optimization (Reducing worst case space to Log n )

In QuickSort, partition function is in-place, but we need extra space for recursive function calls. A simple implementation of QuickSort makes two calls to itself… Read More »