Professional KnowledgeHardIBPS SO IT
Time to build a BST from n keys already sorted in ascending order by successive insertion is:
- A. O(n^2)
- B. O(n log n)
- C. O(n)
- D. O(log n)
Correct answer: A. O(n^2)
The tree degenerates into a chain, so the i-th insertion costs O(i).
Practise more IT Officer Professional Knowledge (IBPS SO) questionsIT Officer Professional Knowledge (IBPS SO): notes and key points
More IT Officer Professional Knowledge (IBPS SO) questions
- 0/1 knapsack with capacity W and n items by dynamic programming has complexity:
- Edit distance between kitten and sitting is:
- Which problem is NP-complete?
- Regular expression (a+b)abb corresponds to a DFA over {a,b} with the minimum number of states equal to:
- Which of these is a context-free but not a regular language?
- Which of the following about C++ virtual functions is correct?