## 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 »

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 »

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 »

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 »

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 »

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 »

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 »

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 »

Which sorting algorithms is most efficient to sort string consisting of ASCII characters? (A) Quick sort (B) Heap sort (C) Merge sort (D) Counting sort… Read More »

Which of the following sorting algorithms has the lowest worst-case complexity? (A) Merge Sort (B) Bubble Sort (C) Quick Sort (D) Selection Sort Answer: (A)… Read More »

Consider the Quicksort algorithm. Suppose there is a procedure for finding a pivot element which splits the list into two sub-lists each of which contains… Read More »

In quick sort, for sorting n elements, the (n/4)th smallest element is selected as pivot using an O(n) time algorithm. What is the worst case… Read More »

A list of n string, each of length n, is sorted into lexicographic order using the merge-sort algorithm. The worst case running time of this… Read More »

Which sorting algorithm will take least time when all elements of input array are identical? Consider typical implementations of sorting algorithms. (A) Insertion Sort (B)… Read More »

In a modified merge sort, the input array is splitted at a position one-third of the length(N) of the array. What is the worst case… Read More »

The tightest lower bound on the number of comparisons, in the worst case, for comparison-based sorting is of the order of (A) N (B) N^2… Read More »