InterviewSolution
Saved Bookmarks
| 1. |
What is the time complexity for finding the node at x position where n is the length of the rope?(a) O (log n)(b) O (n!)(c) O (n^2)(d) O (1)I need to ask this question from Binary Trees in division Binary Trees of Data Structures & Algorithms IThis question was addressed to me in a job interview. |
|
Answer» RIGHT option is (a) O (log N) For explanation: In order to FIND the node at x position in a rope data structure where N is the length of the rope, we start a recursive SEARCH from the root node. So the time complexity for worst case is FOUND to be O (log N). |
|