1.

Which one of the following is the tightest upper bound that represents the time complexity of inserting an object into a binary search tree of n nodes?(a) O(1)(b) O(long)(c) O(n)(d) O(long)I got this question in my homework.This intriguing question comes from Syntax-Directed Definitions and Translations in portion Syntax Directed Definition and Translations of Compiler

Answer»

The correct answer is (c) O(n)

Easiest explanation: For skewed BINARY search tree on n nodes, the upper bound to INSERT a NODE is O (n).



Discussion

No Comment Found

Related InterviewSolutions