Sorting, Sorting Set 1, Sorting Set 2 [Merge Sort] Sort array after converting elements to their squares Given a array of both positive and negative integers ‘arr[]’ which are sorted. Task is to sort square of the numbers of the Array. GFG Algo: 1. Efficient solution is based on the fact that given array is… Continue reading Sorting – Set 3

# Category: Sorting

## Sorting – Set 2

Sorting Set 1 Sorting Set 3 Given an array of n integers. The task is to check whether an arithmetic progression can be formed using all the given elements. If possible print “Yes”, else print “No”. GFG Algo: We don't really need to know the arithmetic difference. We can just take the diff of first two and… Continue reading Sorting – Set 2

## Sorting – Set 1

Sorting Set 2 Sorting Set 3 Given an array of n distinct elements. Check whether the given array is a k sorted array or not. A k sorted array is an array where each element is at most k distance away from its target position in the sorted array. GFG. Algo: Copy the array into another… Continue reading Sorting – Set 1

## Sorting

Big O CheatSheet *** https://en.wikipedia.org/wiki/External_sorting - used in questions like this - http://blog.gainlo.co/index.php/2016/05/10/duplicate-elements-of-an-array/ Geekforgeek.org - Problem set on sorting Topological Sort / Topological Graph - In a tennis tournament of N players every player plays with every other player. The following condition always hold - If player P1 has won the match with P2 and player P2 has won from… Continue reading Sorting