0 votes 0 votes The height of a binary tree having 'i' nodes at level 'i' considering root to be at level 1 is ------. where 'n' is the total no of nodes in the tree. A. O(logn) B. O(n) C. O(ROOT(N)) D. O(N2) DS data-structures binary-tree + – Aman Bisht asked Jun 12, 2017 • recategorized Jul 6, 2022 by Lakshman Bhaiya Aman Bisht 1.1k views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
Best answer 1 votes 1 votes No of nodes =n N = summation of n from i=1to h N= n² from 1to h N= h² -1 √N+1= h h=O(√N) Ketan Dhakate answered Jun 12, 2017 • selected Jun 12, 2017 by Aman Bisht Ketan Dhakate comment Share Follow See all 0 reply Please log in or register to add a comment.
1 votes 1 votes Let's assume height of the binary tree is h. Then, n = 1 + 2 + 3 + ... + h = h(h+1)/2 h2 + h - 2n = 0 h = (−1 ± √(1 + 8n))/2 = O(√n) ref: http://www.techtud.com/doubt/height-binary-tree-having-i-nodes-level-i-co rishu_darkshadow answered Sep 18, 2017 rishu_darkshadow comment Share Follow See all 0 reply Please log in or register to add a comment.