It is a well established fact that merge sort runs faster than insertion sort. Using asymptotic analysis we can prove that merge sort runs in O(nlogn) time and insert...

Share

Given an unsorted array arr[0..n-1] of size n, find the minimum length subarray arr[s..e] such that sorting this subarray makes the whole array sorted.
Examples:
1) ...

Share

We have discussed Pancake Sorting in the previous post. Following is a problem based on Pancake Sorting.
Given an an unsorted array, sort the given array. You are al...

Share

Given an array of strings arr[]. Sort given strings using Bubble Sort and display the sorted array.
In Bubble Sort, the two successive strings arr[i] and arr[i+1] are...

Share

// C++ program for sorting dates using selectio0n sort
#include<bits/stdc++.h>
using namespace std;
struct date
{
    int day;...

Share

What is Vector of Pairs?
A pair is a container which stores two values mapped to each other, and a vector containing multiple number of such pairs is called a vector ...

Share

What is a 2D Vector?
A 2D vector is vector of vectors. It is an matrix implemented with the help of vectors.
// C++ code to demonstrate 2D vector
#include&l...

Share

We have discussed some of the cases of sorting vector of pairs in below set 1.
Sorting Vector of Pairs in C++ | Set 1 (Sort by first and second)
More cases are discus...

Share

We have discussed some of the cases of sorting 2D vector in below set 1.
Sorting 2D Vector in C++ | Set 1 (By row and column)
More cases are discussed in this article...

Share

We have discussed some of the cases of sorting 2D vector in below set 1 and set 2.
Sorting 2D Vector in C++ | Set 1 (By row and column)
Sorting 2D Vector in C++ | Set...

Share