adplus-dvertising

Welcome to the Trees MCQs Page

Dive deep into the fascinating world of Trees with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of Trees, a crucial aspect of Data Structures and Algorithms. In this section, you will encounter a diverse range of MCQs that cover various aspects of Trees, from the basic principles to advanced topics. Each question is thoughtfully crafted to challenge your knowledge and deepen your understanding of this critical subcategory within Data Structures and Algorithms.

frame-decoration

Check out the MCQs below to embark on an enriching journey through Trees. Test your knowledge, expand your horizons, and solidify your grasp on this vital area of Data Structures and Algorithms.

Note: Each MCQ comes with multiple answer choices. Select the most appropriate option and test your understanding of Trees. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!

Trees MCQs | Page 26 of 32

Explore more Topics under Data Structures and Algorithms

Q251.
Heap can be used as ________________
Discuss
Answer: (a).Priority queue
Q252.
An array consist of n elements. We want to create a heap using the elements. The time complexity of building a heap will be in order of
Discuss
Answer: (b).O(n*logn)
Q253.
What is the space complexity of searching in a heap?
Discuss
Answer: (b).O(n)
Q254.
What is the best case complexity in builading a heap?
Discuss
Answer: (d).O(n)
Q255.
Given the code ,choose the correct option that is consistent with the code.
Here A is the heap
build(A,i)
 left-> 2*i
 right->2*i +1
 temp- > i
 if(left<= heap_length[A] ans A[left] >A[temp])
 temp -> left
 if (right = heap_length[A] and A[right] > A[temp])
 temp->right
 if temp!= i
 swap(A[i],A[temp])
 build(A,temp)
Discuss
Answer: (a).It is the build function of max heap
Q256.
What is the location of parent node for any arbitary node i?
Discuss
Answer: (c).floor(i/2) position
Q257.
State the complexity of algorithm gien below:
int function(vector<int> arr)
 int len=arr.length();
 if(len==0)
 return;
 temp=arr[len-1];
 arr.pop_back();
 return temp;
Discuss
Answer: (c).O(1)
Q258.
Given an array of element 5,7,9,1,3,10,8,4. Tick all the correct sequences of elements after inserting all the elements in a min-heap.
Discuss
Answer: (a).1,3,4,7,8,9,10
Q259.
For construction of a binary heap with property that parent node has value less than child node.In reference to that which line is incorrect. Line indexed from 1.
add(int k)
{
 heap_size++;
     int i = heap_size - 1;
     harr[i] = k;
     while (i != 0 && harr[parent(i)] < harr[i])
     {
         swap(&harr[i], &harr[parent(i)]);
         i = parent(i);
        }
}
Discuss
Answer: (b).Line โ€“ 5
Discuss
Answer: (b).Every right child of node has greater value than parent node

Suggested Topics

Are you eager to expand your knowledge beyond Data Structures and Algorithms? We've curated a selection of related categories that you might find intriguing.

Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!