# Tag Archives: Sorting Quiz

## Minimum inverting factor in an array

Given an array of n positive integers, the task is to find the minimum inverting factor in the given array. Inverting factor is defined as… Read More »

## Pair of arrays with equal sum after removing exactly one element from each

Given K arrays of different size. The task is to check if there exist any two arrays which have the same sum of elements after… Read More »

## Minimum number of prefix reversals to sort permutation of first N numbers

Given N numbers which have a permutation of first N numbers. In a single operation, any prefix can be reversed. The task is to find… Read More »

## Program to check similarity of given two triangles

Given four array of 3 numbers each which represents sides and angles of two triangles. The task is to check if two triangles are similar… Read More »

## Maximise the number of toys that can be purchased with amount K

Given an array consisting of cost of toys. Given an integer K depicting the amount of money available to purchase toys. Write a program to… Read More »

## Pair formation such that maximum pair sum is minimized

Given an array of size 2 * N integers. Divide the array into N pairs, such that the maximum pair sum is minimized. In other… Read More »

## Sorting array using Stacks

Given an array of elements, task is to sort these elements using stack. Prerequisites : Stacks Examples : Input : 8 5 7 1 9… Read More »

## Check if an array is stack sortable

Given an array of N distinct elements where elements are between 1 and N both inclusive, check if it is stack-sortable or not. An array… Read More »

## Rearrange array such that arr[i] >= arr[j] if i is even and arr[i]<=arr[j] if i is odd and j < i

Given an array of n elements. Our task is to write a program to rearrange the array such that elements at even positions are greater… Read More »

## Can QuickSort be implemented in O(nLogn) worst case time complexity?

The worst case time complexity of a typical implementation of QuickSort is O(n2). The worst case occurs when the picked pivot is always an extreme… Read More »

## Binary Insertion Sort

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

## Algorithms | Sorting | Question 23

Given an array where numbers are in range from 1 to n6, which sorting algorithm can be used to sort these number in linear time?… Read More »

## Algorithms | Sorting | Question 23

Which of the following is true about merge sort? (A) Merge Sort works better than quick sort if data is accessed from slow sequential memory.… Read More »

## Comparator function of qsort() in C

Standard C library provides qsort() that can be used for sorting an array. As the name suggests, the function uses QuickSort algorithm to sort the… Read More »

## Algorithms | Sorting | Question 23

The number of elements that can be sorted in time using heap sort is (A) (B) (C) (d) (A) A (B) B (C) C (D)… Read More »