GATE Overflow - Recent questions tagged sorting
http://gateoverflow.in/tag/sorting
Powered by Question2AnswerSorting
http://gateoverflow.in/126753/sorting
Which sorting algorithim is best if<br />
<br />
exhactly only half of the elements are in correct position ?Othershttp://gateoverflow.in/126753/sortingSun, 23 Apr 2017 18:47:10 +0000Which sorting algorithm can be used to sort a random linked list with minimum time complexity ?
http://gateoverflow.in/126646/which-sorting-algorithm-random-linked-minimum-complexity
Which sorting algorithm can be used to sort a random linked list with minimum time complexity ?<br />
<br />
A)mergesort<br />
<br />
B)quicksort<br />
<br />
C)radixsort<br />
<br />
D)insertionsort<br />
<br />
E)heapsortAlgorithmshttp://gateoverflow.in/126646/which-sorting-algorithm-random-linked-minimum-complexitySun, 23 Apr 2017 07:22:59 +0000algorithmss, Sorting,
http://gateoverflow.in/126398/algorithmss-sorting
Consider the array A containing n distinct elements. Let K = n – $n^{0.75}$. The first ⌊K⌋<br />
elements of A are all in sorted order, but nothing is known about the remaining elements of<br />
A. what is the time complexity to sort given array A.<br />
<br />
A. O($n^{0.75}$)<br />
<br />
B. O(n)<br />
<br />
C. O($n^{2}$)<br />
<br />
D. O(nlogn)Algorithmshttp://gateoverflow.in/126398/algorithmss-sortingFri, 21 Apr 2017 06:34:05 +0000With quick sort The results after first partioning of the given array
http://gateoverflow.in/125609/with-quick-sort-results-after-first-partioning-given-array
With quick sort The results after first partioning of the given array. <br />
<br />
A = (2,8,7,1,3,5,6,4,9).<br />
<br />
Analysis the time complexity of Quick sort in the best case.Algorithmshttp://gateoverflow.in/125609/with-quick-sort-results-after-first-partioning-given-arraySat, 15 Apr 2017 03:55:23 +0000GATE 2008 Quick Sort
http://gateoverflow.in/122868/gate-2008-quick-sort
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 at least one-fifth of the elements. Let T(n) be the number of comparisons required to sort n elements. Then— <br />
A. T(n) <= 2T(n/5) + n <br />
<br />
B. T(n) <= T(n/5) + T(4n/5) + n<br />
<br />
C. T(n) <= 2T(4n/5) + n <br />
<br />
D. T(n) <= 2T(n/2) + n <br />
<br />
<br />
The Answer to this question is B. My doubt is that why can't the answer be C? My logic is that if there are (n/5) elements on one side and (4n/5) on the other, then T(n)= T(n/5) + T(4n/5) + n. Here, 4n/5 > n/5 so definitely, time taken will be less than 2T(4n/5) + n, if elements are more than (n/5)( since it is given 'AT LEAST').<br />
<br />
Where am I going wrong?Algorithmshttp://gateoverflow.in/122868/gate-2008-quick-sortWed, 29 Mar 2017 09:18:07 +0000algorithm, Sorting
http://gateoverflow.in/120851/algorithm-sorting
which sorting algorihm is used if we have a telephone directory wit 1,00,000 entries ?Algorithmshttp://gateoverflow.in/120851/algorithm-sortingTue, 07 Mar 2017 15:44:26 +0000Space complexity
http://gateoverflow.in/116315/space-complexity
Which of the following algorithm have the smallest memory requirement i.e Low space complexity including data space and run time stack for recursive calls.<br />
<br />
A)insertion sort<br />
<br />
B)quick sort<br />
<br />
C)merge sort<br />
<br />
D)selection sortProgramminghttp://gateoverflow.in/116315/space-complexitySun, 05 Feb 2017 16:34:02 +0000#algorithms #best #algo
http://gateoverflow.in/115346/%23algorithms-%23best-%23algo
<p><strong>Best algorithm for this set:</strong></p>
<p><strong>1.</strong>Independently sorting each of 1,000,000 arrays, each with 5 elements.</p>
<p><strong>2.</strong>Sorting a set of 4,000,000 numbers in worst case O(n lg n) time.</p>Algorithmshttp://gateoverflow.in/115346/%23algorithms-%23best-%23algoFri, 03 Feb 2017 13:55:25 +0000Sorting Techniques
http://gateoverflow.in/111953/sorting-techniques
<p>What is the best sorting algorithm to use for the elements in array are more than 1 million in general?</p>
<table>
<tbody>
<tr>
<td>
<p>A</p>
</td>
<td>
<p>Merge sort.</p>
</td>
</tr>
<tr>
<td>
<p>B</p>
</td>
<td>
<p>Bubble sort.</p>
</td>
</tr>
<tr>
<td>C</td>
<td>
<p>Quick sort.</p>
</td>
</tr>
<tr>
<td>
<p>D</p>
</td>
<td>
<p>Insertion sort.</p>
</td>
</tr>
</tbody>
</table>
<p> Ans:C</p>
<p>Source: <a rel="nofollow" href="http://quiz.geeksforgeeks.org/algorithms-insertionsort-question-6/">http://quiz.geeksforgeeks.org/algorithms-insertionsort-question-6/</a></p>
<p>You have to sort 1 GB of data with only 100 MB of available main memory. Which sorting technique will be most appropriate?</p>
<table>
<tbody>
<tr>
<td>
<p>A</p>
</td>
<td>
<p>Heap sort</p>
</td>
</tr>
<tr>
<td>B</td>
<td>
<p>Merge sort</p>
</td>
</tr>
<tr>
<td>C</td>
<td>
<p>Quick sort</p>
</td>
</tr>
<tr>
<td>
<p>D</p>
</td>
<td>
<p>Insertion sort</p>
</td>
</tr>
</tbody>
</table>
<p>Ans: B</p>
<p>Source: <a rel="nofollow" href="http://quiz.geeksforgeeks.org/algorithms-searching-and-sorting-question-16/">http://quiz.geeksforgeeks.org/algorithms-searching-and-sorting-question-16/</a></p>
<p>Kindly explain on why the answers are different?</p>
<p> </p>Algorithmshttp://gateoverflow.in/111953/sorting-techniquesFri, 27 Jan 2017 13:10:35 +0000Insertion sort
http://gateoverflow.in/111884/insertion-sort
<p>Consider the array A[]= {6,4,8,1,3} apply the insertion sort to sort the array . Consider the cost associated with each sort is 25 rupees , what is the total cost of the insertion sort when element 1 reaches the first position of the array ?
<br>
<strong>(A)</strong> 50
<br>
<strong>(B)</strong> 25
<br>
<strong>(C)</strong> 75
<br>
<strong>(D)</strong> 100</p>
<p>Source: <a rel="nofollow" href="http://quiz.geeksforgeeks.org/algorithms-insertionsort-question-4/">http://quiz.geeksforgeeks.org/algorithms-insertionsort-question-4/</a></p>Algorithmshttp://gateoverflow.in/111884/insertion-sortFri, 27 Jan 2017 10:48:39 +0000quick sort
http://gateoverflow.in/108311/quick-sort
If we use quicksort algorithm to sort the elements: $16, 13, 14, 12, 21, 16, 23$ and $15$ in ascending order, what is the output after the first pass of quicksort? (Assume pivot element is beginning of an array)Algorithmshttp://gateoverflow.in/108311/quick-sortFri, 20 Jan 2017 12:05:06 +0000merge sort
http://gateoverflow.in/106042/merge-sort
<p><img alt="" height="30" src="http://gateoverflow.in/?qa=blob&qa_blobid=12449262815565518467" width="662"></p>Programminghttp://gateoverflow.in/106042/merge-sortSun, 15 Jan 2017 18:14:49 +0000Can anyone make the table of Complexities, No. of swaps required for N elements for all type of sorts?
http://gateoverflow.in/105123/anyone-make-table-complexities-swaps-required-elements-sorts
If possible,. all 3 cases (best,average, worst)Algorithmshttp://gateoverflow.in/105123/anyone-make-table-complexities-swaps-required-elements-sortsFri, 13 Jan 2017 14:12:46 +0000General doubt on calculating the Time complexity for the given Insertion Sort Algorithm in the worst and average case
http://gateoverflow.in/104638/general-calculating-complexity-insertion-algorithm-average
INSERTION-SORT (A, n) ⊳ A[1 . . n]<br />
<br />
for (j ← 2 to len(A) )<br />
<br />
{<br />
<br />
key ← A[ j];<br />
<br />
i ← j – 1 ;<br />
<br />
while (i > 0 and A[i] > key)<br />
<br />
{<br />
<br />
A[i+1] ← A[i];<br />
<br />
i ← i – 1;<br />
<br />
}<br />
<br />
A[i+1] = key;Algorithmshttp://gateoverflow.in/104638/general-calculating-complexity-insertion-algorithm-averageThu, 12 Jan 2017 15:24:48 +0000Consider the array of size n. the first (n – 1) elements are already sorted.
http://gateoverflow.in/97360/consider-the-array-size-the-first-elements-are-already-sorted
<p>Consider the array of size n. the first (n – 1) elements are already sorted. What is the worst case time complexity to insert a n<sup>th</sup> element in an array after insertion the array should be in sorted order</p>
<ol>
<li> O(1)</li>
<li> O(n)</li>
<li> O(n log n)</li>
<li> O(n<sup>2</sup>)</li>
</ol>Algorithmshttp://gateoverflow.in/97360/consider-the-array-size-the-first-elements-are-already-sortedTue, 27 Dec 2016 11:13:21 +0000Consider an array ‘A’ with 2m elements. The elements in odd position are sorted in non-increasing order that
http://gateoverflow.in/96981/consider-array-elements-elements-position-sorted-increasing
<p>Consider an array ‘A’ with 2m elements. The elements in odd position are sorted in non-increasing order that is A[1] >= A[3] >= A[5]......A[2m-1] The elements in even position are sorted in non-decreasing order, that is A[2]<= A[4] <= A[6].....A[2m]. Which of the following method is recommended for finding if a given number is in array?</p>
<ol>
<li> Sort the given array using quick sort and then apply binary search on array.</li>
<li> Merge the sorted lists and apply binary search.</li>
<li> Apply binary search on the entire array.</li>
<li> Separately apply binary search on the odd position elements and even position elements</li>
</ol>
<p>i thought answer would be B,cuz then O(n) time will be taken but answer is D.how can we apply binary search on odd and even seperatly..pls guide me</p>DShttp://gateoverflow.in/96981/consider-array-elements-elements-position-sorted-increasingMon, 26 Dec 2016 12:51:52 +0000Algorithm || Minimum comparison sorting
http://gateoverflow.in/95725/algorithm-minimum-comparison-sorting
The lower bound on the no. of comparisons required to sort n numbers is __________ ?Algorithmshttp://gateoverflow.in/95725/algorithm-minimum-comparison-sortingFri, 23 Dec 2016 07:39:29 +0000TIFR2017-B-7
http://gateoverflow.in/95699/tifr2017-b-7
<p>An array of $n$ distinct elements is said to be un-sorted if for every index $i$ such that $ 2 \leq i \leq n-1$, either $A[i] > max \{A [i-1], A[i+1]\}$, or $A[i] < min \{A[i-1], A[i+1]\}$. What is the time-complexity of the fastest algorithm that takes as input a sorted array $A$ with $n$ distinct elements, and un-sorts $A$?</p>
<ol style="list-style-type:upper-alpha">
<li>$O(n \: \log \: n)$ but not $O(n)$</li>
<li>$O(n)$ but not $O(\sqrt{n})$</li>
<li>$O(\sqrt{n})$ but not $O(\log n)$</li>
<li>$O(\log n)$ but not $O(1)$</li>
<li>$O(1)$</li>
</ol>Algorithmshttp://gateoverflow.in/95699/tifr2017-b-7Fri, 23 Dec 2016 07:04:52 +0000No of comparisons
http://gateoverflow.in/94013/no-of-comparisons
<p> </p>
<p><strong>Q.15 </strong>An array of n numbers is given, where n is an even number. The maximum as well as the minimum of these n numbers needs to be determined. Which of the following is TRUE about the no. of comparisons needed?</p>
<p>(a) Atleast 2n-C comparisons are needed</p>
<p>(b) Atmost 1.5n-2 comparisons are needed</p>
<p>(c) Atleast nlog2 n comparisons are needed</p>
<p>(d) None of the above
<br>
</p>Algorithmshttp://gateoverflow.in/94013/no-of-comparisonsSun, 18 Dec 2016 10:26:20 +0000Insertion Sort
http://gateoverflow.in/93491/insertion-sort
<p><img alt="" src="http://gateoverflow.in/?qa=blob&qa_blobid=15204843316127221747"></p>Algorithmshttp://gateoverflow.in/93491/insertion-sortFri, 16 Dec 2016 17:50:38 +0000Bucket Sort
http://gateoverflow.in/91825/bucket-sort
Does Bucket sort input is always between 0 and 1?<br />
<br />
Or the input has to be distributed between [0,1) interval uniformly before applying bucket sort?Algorithmshttp://gateoverflow.in/91825/bucket-sortSun, 11 Dec 2016 17:09:23 +0000GATE1988-1iii
http://gateoverflow.in/91338/gate1988-1iii
Quicksort is ________ efficient than heapsort in the worst case.Algorithmshttp://gateoverflow.in/91338/gate1988-1iiiSat, 10 Dec 2016 07:20:44 +0000sorting
http://gateoverflow.in/91087/sorting
<p><img alt="" src="http://gateoverflow.in/?qa=blob&qa_blobid=1329386055046055369"></p>Algorithmshttp://gateoverflow.in/91087/sortingFri, 09 Dec 2016 10:24:04 +0000Algo-Sorting
http://gateoverflow.in/90972/algo-sorting
You have 10000 dates of the form YYYYMMDD.Which sorting method is more efficient?Algorithmshttp://gateoverflow.in/90972/algo-sortingFri, 09 Dec 2016 06:08:22 +0000GATE1989-9
http://gateoverflow.in/89083/gate1989-9
<p>An input files has 10 records with keys as given below:</p>
<p>25 7 34 2 70 9 61 16 49 19.</p>
<p>This is to be sorted in non-decreasing order.</p>
<ol style="list-style-type:lower-roman">
<li>Sort the input file using QUICKSORT by correctly positioning the first element of the file/subfile. Show the subfiles obtained at all intermediate steps. Use square brackets to demarcate subfiles.</li>
<li>Sort the input file using 2-way- MERGESORT showing all major intermediate steps. Use square brackets to demarcate subfiles.</li>
</ol>Algorithmshttp://gateoverflow.in/89083/gate1989-9Sat, 03 Dec 2016 10:34:34 +0000Sorting
http://gateoverflow.in/87424/sorting
<p><img alt="" src="http://gateoverflow.in/?qa=blob&qa_blobid=12204445782040858268"></p>
<p>I answered this as $O(n^2)$ considering the question asks for best worst case of all inplace sorting algorithms.</p>Algorithmshttp://gateoverflow.in/87424/sortingMon, 28 Nov 2016 08:28:22 +0000Sorting
http://gateoverflow.in/85299/sorting
Which of the following sorting algorithm can sort at runtime?<br />
<br />
1). Heapsort<br />
<br />
2). Merge sort<br />
<br />
3). Insertion Sort<br />
<br />
4). Selection Sort<br />
<br />
This is a self made question. So many options many be correct.Algorithmshttp://gateoverflow.in/85299/sortingWed, 23 Nov 2016 15:32:03 +0000GATE1990-3-v
http://gateoverflow.in/84830/gate1990-3-v
<p>Choose the correct alternatives (More than one may be correct).</p>
<p>The complexity of comparision based sorting algorithms is:</p>
<ol style="list-style-type:upper-alpha">
<li>$\Theta (n \log n)$</li>
<li>$\Theta (n)$</li>
<li>$\Theta \left(n^2\right)$</li>
<li>$\Theta (n\sqrt n)$</li>
</ol>Algorithmshttp://gateoverflow.in/84830/gate1990-3-vTue, 22 Nov 2016 13:05:18 +0000New Gradience Sorting
http://gateoverflow.in/82458/new-gradience-sorting
There are many variations of Quicksort. We may choose the pivot for each partition step in various ways. There are various strategies for partitioning an array segment into one subpartition of consecutive array positions that has values less than or equal to the pivot and another subpartition of consecutive array positions with those values greater than the pivot. The recursion that partitions the array into smaller and smaller segments may be stopped in various ways. However, even with all that variation, not any set of values can ever be a partition at any level. Your problem is to consider the Quicksorting of an array that initially has the values 3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 8, 9, 7 and identify below the one set of values that could possibly be one entire partition at some level of the Quicksort recursion<br />
<br />
a) 6, 9, 7, 8, 9<br />
<br />
b) 3, 1, 3, 1<br />
<br />
c) 5, 4, 3, 3, 5<br />
<br />
d) 1, 4, 1, 3Algorithmshttp://gateoverflow.in/82458/new-gradience-sortingMon, 14 Nov 2016 20:09:42 +0000Geeksquiz
http://gateoverflow.in/82429/geeksquiz
<p>Given an unsorted array. The array has this property that every element in array is at most k distance from its position in sorted array where k is a positive integer smaller than size of array. Which sorting algorithm can be easily modified for sorting this array and what is the obtainable time complexity?</p>
<p>A) Insertion Sort with time complexity O(kn)</p>
<p>B) Heap Sort with time complexity O(nLogk)</p>
<p>C) Quick Sort with time complexity O(kLogk)</p>
<p>D) Merge Sort with time complexity O(kLogk)</p>
<p>Answer given is B, and i somewhat get the resoning behind it,but one thing which i can not understand is why can't we follow same resoning even if this information that every element is distant by k units is not given?</p>
<p>The resoning is :</p>
<p>1) Create a Min Heap of size k+1 with first k+1 elements. This will take O(k) time (See <a rel="nofollow" href="http://www.geeksforgeeks.org/archives/12580">this GFact</a>)
<br>
2) One by one remove min element from heap, put it in result array, and add a new element to heap from remaining elements.</p>
<p>Removing an element and adding a new element to min heap will take Logk time. So overall complexity will be O(k) + O((n-k)*logK.</p>
<p>Pls provide your explantion</p>Programminghttp://gateoverflow.in/82429/geeksquizMon, 14 Nov 2016 18:42:55 +0000GATE1987-1-xviii
http://gateoverflow.in/80366/gate1987-1-xviii
<p>Let P be a quicksort program to sort numbers in ascending order. Let $t_{2}$ and $t_{2}$ be the time taken by the program for the inputs [1 2 3 4] and [5 4 3 2 1], respectively. Which of the following holds?</p>
<ol style="list-style-type:upper-alpha">
<li>$t_{1} = t_{2}$</li>
<li>$t_{1} > t_{2}$</li>
<li>$t_{1} < t_{2}$</li>
<li>$t_{1}=t_{2}+5 \log 5$</li>
</ol>Algorithmshttp://gateoverflow.in/80366/gate1987-1-xviiiTue, 08 Nov 2016 18:53:09 +0000What will be the complexity of given modified merge sort
http://gateoverflow.in/80183/what-will-be-the-complexity-of-given-modified-merge-sort
<p>Shiva modified merge sort as:</p>
<ol>
<li>divide the array into 3 equal parts insttead of 2.</li>
<li>sort each part</li>
<li>do a 3 way merge.</li>
</ol>
<p>What can we conclude about modified three way merge sort?</p>
<p>A. It has same worst case complexity as normal merge sort </p>
<p>B. It has less complexity as comparisons reduces to log 3 level.</p>
<p>C. It is more complex due to 3 way merge</p>
<p>D. The algorithm will not work perfectly for some inputs.</p>Algorithmshttp://gateoverflow.in/80183/what-will-be-the-complexity-of-given-modified-merge-sortTue, 08 Nov 2016 09:05:41 +0000Space complexity of heap sort
http://gateoverflow.in/79909/space-complexity-of-heap-sort
Why space complexity of heapsort is O(1)....and why not O(logn)..because of space required by recursion calls which is equivalent to height of the tree...where am i getting wrong plz help...Algorithmshttp://gateoverflow.in/79909/space-complexity-of-heap-sortMon, 07 Nov 2016 13:56:25 +0000quick sort
http://gateoverflow.in/79724/quick-sort
Is quick sort in-place algorithm?Algorithmshttp://gateoverflow.in/79724/quick-sortMon, 07 Nov 2016 04:39:13 +0000sorting
http://gateoverflow.in/79699/sorting
how to sort n integers in the range 0 to n3−1 in O(n) time.Algorithmshttp://gateoverflow.in/79699/sortingMon, 07 Nov 2016 03:14:45 +0000bucket osrt
http://gateoverflow.in/79673/bucket-osrt
What simple change to the bucket sort preserves its linear average-case running time and makes its worst-case running time O(nlgn)?Algorithmshttp://gateoverflow.in/79673/bucket-osrtMon, 07 Nov 2016 02:21:28 +0000Sorting
http://gateoverflow.in/79666/sorting
Is the bucket sort is a comparison based sorting algorithm?Algorithmshttp://gateoverflow.in/79666/sortingMon, 07 Nov 2016 02:08:15 +0000Test Series
http://gateoverflow.in/78507/test-series
Which algorithm has smallest memory requirement in terms of data space and runtime stack(for recursive calls)? (Low Space Complexity)<br />
<br />
A. Insertion sort<br />
<br />
B. Selection sort<br />
<br />
C. Quick Sort<br />
<br />
D. Merge SortAlgorithmshttp://gateoverflow.in/78507/test-seriesThu, 03 Nov 2016 10:40:05 +0000Quick sort
http://gateoverflow.in/78215/quick-sort
<p>@arjun sir
<br>
why is quick sort with median as pivot not in practice even though it can sort the worst case list in O(nlogn) time?
<br>
median can be found in O(n) time and this divides list into two halves.
<br>
recurrance relation becomes
<br>
T(n) = 2T(n/2)+O(n)
<br>
which gives O(nlogn)
<br>
why do we still say worst case TC of quick sort is O(n^2) when median as pivot can do it in O(nlogn) time?
<br>
<a rel="nofollow" href="http://www.geeksforgeeks.org/can-quicksort-implemented-onlogn-worst-case-time-complexity/">http://www.geeksforgeeks.org/can-quicksort-implemented-onlogn-worst-case-time-complexity/</a>
<br>
this link says we dont implement it bcoz "The hidden constants in this approach are high compared to normal Quicksort"
<br>
but why are we caring about constants here? </p>Algorithmshttp://gateoverflow.in/78215/quick-sortWed, 02 Nov 2016 07:09:00 +0000Doubt: DAA: Quick Sort
http://gateoverflow.in/78213/doubt-daa-quick-sort
<p>If every time a median which takes O(n) to be found, is chosen as pivot, then Quick Sort takes <strong>theeta(nlogn)</strong> time complexity.
<br>
My question is if all the elements are same, will still be this median Quick Sort have time complexity as <strong>theeta(nlogn)??</strong>
<br>
Can someone please run the algo for 10, 10, 10, 10, 10 if the worst time TC is nlogn in case if median Quick Sort.</p>Algorithmshttp://gateoverflow.in/78213/doubt-daa-quick-sortWed, 02 Nov 2016 07:00:18 +0000DAA: Radix Sort
http://gateoverflow.in/78039/daa-radix-sort
<p>In RADIX sort, it's written that:</p>
<p><strong>"Given n d-dgits numbers in which each digit can take upto k(0 to k-1) possible values, then RADIX SORT sorts them correctly in Theeta(d*(n+k)) time"</strong></p>
<p>Can someone please explain this part?</p>Algorithmshttp://gateoverflow.in/78039/daa-radix-sortTue, 01 Nov 2016 09:15:45 +0000Randomised quicksort
http://gateoverflow.in/71608/randomised-quicksort
Let us a consider a series of events where a random partition procedure always picks the median element among n distinct numbers dividing the array into two equal halves ( ignore floor and ceiling). What is the probability that such a partition procedure always picks the median element in all subsequent arrays till the entire array is sorted.Algorithmshttp://gateoverflow.in/71608/randomised-quicksortTue, 04 Oct 2016 14:16:46 +0000Decision Tree: 'At Least' means floor value or ceil value?
http://gateoverflow.in/70946/decision-tree-at-least-means-floor-value-or-ceil-value
<p>In the following screenshot, they have given that height of a decision tree in comparison based sorting is logn!. I agree to it, no problem!!
<br>
but my question is do I need to consider ceil(logn!) or floor(logn!)?</p>
<p><img alt="" src="http://gateoverflow.in/?qa=blob&qa_blobid=332509871918855502"></p>Algorithmshttp://gateoverflow.in/70946/decision-tree-at-least-means-floor-value-or-ceil-valueSat, 01 Oct 2016 13:21:04 +0000Modified Insertion sort
http://gateoverflow.in/69473/modified-insertion-sort
Insertion Sorts complexity is O(n+d) where d is no. of inversions.<br />
<br />
(There are some questions in gate where no. of inversions are given in terms of n.)<br />
<br />
I am unable to Understand this complexity Derivation. Plz make me understand. Thank U.Algorithmshttp://gateoverflow.in/69473/modified-insertion-sortSat, 24 Sep 2016 09:08:08 +00007th smallest element in a Min-Heap
http://gateoverflow.in/66418/7th-smallest-element-in-a-min-heap
In a min-heap with n elements <br />
<br />
1). The 7th smallest element can be found in time, if duplicates are allowed ?<br />
<br />
2). The 7th distinct smallest element can be found in time, If duplicates are allowed ?Algorithmshttp://gateoverflow.in/66418/7th-smallest-element-in-a-min-heapSun, 04 Sep 2016 12:08:07 +0000NPTEL MOOC
http://gateoverflow.in/64434/nptel-mooc
<p>Why option (A) is not correct ?</p>
<p><img alt="" height="113" src="http://gateoverflow.in/?qa=blob&qa_blobid=4950578739144711692" width="710"></p>
<p> </p>Algorithmshttp://gateoverflow.in/64434/nptel-moocTue, 23 Aug 2016 06:56:56 +0000