GATE Computer ScienceVery hardGATE CSE · UGC NET

Keys 1..8 are inserted into an empty BST in each of the 8! possible orders. In how many orders is the resulting tree a single path (height 7)?

  1. A. 128
  2. B. 64
  3. C. 256
  4. D. 56

Correct answer: A. 128

Each key after the first must be the minimum or the maximum of the keys not yet inserted: 2^7 = 128.

More Algorithms questions

Exams that ask this topic