Which of the following option is True?

  • I. There are (2N-2) non-null links in a doubly-linked list with N nodes.
  • II. There are (N-1) incoming-links in a binary tree with N nodes.
  • III. Searching for an element in a binary search tree with N nodes takes O(log N).

Which of the following statements are correct?
(A) Only I and II
(B) Only I and III
(C) Only II and III
(D) All I, II, and III


Answer: (A)

Explanation:

  • I. (2N-2). Each node has two outgoing links, but the last ones in each direction are null. (Or: 2N. Counting the head and tail pointers, each node is pointed to by two non-null pointers.)
  • II. (N-1). There’s one incoming to each node except the root.
  • III. False. If the tree isn’t roughly balanced (or non-bushy, or not like a linked list), then it could be O(N).

So, option (A) is correct.

Quiz of this Question


  • Last Updated : 25 Dec, 2018

Share your thoughts in the comments