Computer Science EngineeringHard

A binary tree with n nodes stored with left and right pointers has how many NULL pointers in total?

  1. A. n - 1
  2. B. n
  3. C. 2n
  4. D. n + 1

Correct answer: D. n + 1

There are 2n pointer fields and n-1 of them are used by edges, leaving 2n-(n-1) = n+1 NULL pointers.

More Algorithms, Data Structures & Programming (ISRO CS) questions

Exams that ask this topic