2,427 views
10 10 votes
Give a strategy to sort four given distinct integers $a, b, c, d$ in increasing order that minimizes the number of pairwise comparisons needed to sort any permutation of $a, b, c, d$.

2 Answers

Best answer
11 11 votes

It will be merge sort.

$a,b,c,d$

$1+1$ comparisons for lowest step

$+3$ comparisons for upper one

So, total $5$ comparisons


 

selected by
3 3 votes
Requirements :  Pair wise sorting algo & min no of comparisons.
Ans : Merge sort
Position:
Show:

Related questions

2 2 votes
0 0 answers
656
656 views
go_editor asked Jun 3, 2016
656 views
Consider the following intervals on the real line: $A_1 = (13.3, 18.3) \: A_3 = (8.3, 23.3) − A_1 \cup A_2$ $A_2 = (10.8, 20.8) − A_1 \: A_4 = (5.8, 25.8) − A_1 \cup A_2 ...
2 2 votes
0 0 answers
574
574 views
go_editor asked Jun 3, 2016
574 views
Consider six distinct points in a plane. Let $m$ and $M$ denote the minimum and maximum distance between any pair of points. Show that $M/m \geq \sqrt{3}$.
2 2 votes
1 1 answer
1.4k
1.4k views
go_editor asked Jun 3, 2016
1,376 views
The numbers $1, 2, \dots , 10$ are arranged in a circle in some order. Show that it is always possible to find three adjacent numbers whose sum is at least $17$, irrespec...
1 1 vote
0 0 answers
784
784 views
go_editor asked Jun 3, 2016
784 views
Consider an $m \times n$ integer lattice. A path from $(0, 0)$ to $(m, n)$ can use steps of $(1, 0)$, $(0, 1)$ or diagonal steps $(1, 1)$. Let $D_{m,n}$ be the number of ...