GeeksforGeeks » Multiple Choice Questions
Data Structure Questions
(2 posts)-
1. In a complete binary tree, the parent of any node at index i can be determined by
a. .2i
b. 2i+1
c. i/2
d. i^2-12. Which of these is the correct big -Oh expression for 1+2+3+...+n?
a. O(log n)
b. O(n)
c. O(n log n)
d. O(n^2) -
For 1, answer is (c). Take one example of any complete tree and you can see it.
For 2, answer is (d). 1 + 2... n = n(n+1)/2 = O(n*2)
Reply
You must log in to post.