1.

What will be the time complexity of insertion operation if all the candidates are evenly spaced so that each bin has constant no. of candidates? (m = number of bins intersecting candidate intersects)(a) O(1)(b) O(m)(c) O(m^2)(d) O(log m)The query is from Trees in section Trees of Data Structures & Algorithms IThe question was asked in homework.

Answer»

Correct choice is (b) O(m)

EASY explanation - The process of insertion BECOMES faster in the CASE when the number of CANDIDATES are equally DISTRIBUTED among the bins. In such a case the query operation becomes O(m). It is practically faster than deletion in this case.



Discussion

No Comment Found

Related InterviewSolutions