Home / MCQ Bank / Computer
Computer Binary Search Trees(B Tree) Difficulty: Medium

What must be the missing logic in place of missing lines for finding sum of nodes of binary tree in alternate levels? //e.g:-consider -complete binary tree:-height-3, [1,2,3,4,5,6,7]-answer must be 23 n=power(2,height)-1; //assume input is height and a[i] contains tree elements for(i=1;i<=n;) { //present level is initialized to 1 and sum is initialized to 0 for(j=1;j<=pow(2,currentlevel-1);j++) { sum=sum+a[i]; i=i+1; } //missing logic }

Select the correct option to test your answer:

More Computer Questions

In which stage the following code #include<stdio.h> gets replaced by the contents of the file stdio.h Choose the filemode method which is used to create a new output file with the condition that the file with same name if exists will destroy the old file: Ctrl + U Shortcut is used in Microsoft Word to_____________? Which of the following has high storage density? What is the purpose of the 'std::priority_queue' container in C++ STL?