# Tag Archives: Merge Sort

Given two linked lists sorted in increasing order. Merge them such a way that the result list is in decreasing order (reverse order). Examples:  Input:… Read More
Given two linked lists sorted in increasing order. Merge them such a way that the result list is in decreasing order (reverse order). Examples:  Input:… Read More
Inversion Count for an array indicates – how far (or close) the array is from being sorted. If the array is already sorted, then the… Read More
Given a doubly linked list, write a function to sort the doubly linked list in increasing order using merge sort.For example, the following doubly linked… Read More
Given a binary string s, the task is to calculate the number of such substrings where the count of 1‘s is strictly greater than the… Read More
Given two positive integers, N and M, and an array arr[ ] consisting of (N + M) integers such that the first N elements are… Read More
Given an array A[] of size N, the task is to sort the array in increasing order using In-Place Merge Sort. Examples: Input: A =… Read More
Given an array arr[] consisting of N integers, the task is to count the number of greater elements on the right side of each array… Read More
Given an array arr[] of length N and an integer K, the task is to count the number of pairs (i, j) such that i… Read More
Given an array arr[] consisting of N unique elements, the task is to generate an array B[] of length N such that B[i] is the… Read More
Visualizing algorithms makes it easier to understand them by analyzing and comparing the number of operations that took place to compare and swap the elements.… Read More
Given an N-ary Tree rooted at 1, and an array val[] consisting of weights assigned to every node, and a matrix Q[][], consisting of queries… Read More
Prerequisites: Introduction to Matplotlib, Merge Sort Visualizing algorithms makes it easier to understand them by analyzing and comparing the number of operations that took place… Read More
Given an array arr[] of size N and Q queries of the form [L, R], the task is to find the number of distinct values… Read More
Pre-requisite: Merge Sort, Insertion Sort  Merge Sort: is an external algorithm and based on divide and conquer strategy. In this sorting:   The elements are split… Read More