GATE Computer ScienceModerateGATE CS (PYQ pattern)
How many comparators does Batcher's bitonic sorting network for 16 inputs use?
- A. 63
- B. 64
- C. 96
- D. 80
Correct answer: D. 80
The bitonic sorter for n = 2^k inputs has k(k+1)/2 stages of n/2 comparators: (16/2)·(4·5/2) = 8·10 = 80. Batcher's odd–even merge sort for 16 inputs uses only 63; both were checked to sort all 2¹⁶ binary inputs.
More Algorithms questions
- Which is the tight solution of T(n) = 3T(n/4) + n^(log₄3)·log₂ n?
- Solve T(n) = 2T(√n) + log₂ n for large n. Which is the tight bound?
- Let T(n) = T(n − ⌊√n⌋) + 1 for n > 1 and T(1) = 0. Which is the tight bound?
- Let T(n) = T(n/2) + n(2 − cos n) (n in radians) with T(1) = 1. Which statement about T(n) is correct?
- How many times does x++ execute? for (i = 1; i <= 64; i = 2) for (j = 1; j <= i; j++) for (k = j; k <= i; k = 2) x++;
- How many times does x++ execute? for (i = 1; i <= 200; i++) { j = 1; while (j <= i) { x++; j = 3; } }