My Cart
Your Cart 0

    Your cart is empty.

  • Total (Amount) ₹0.00
Previous year question hub

Trees, Heaps and Graphs - Programming and Data Structures - Computer Science & Information Technology Previous Year Questions

Practice Trees, Heaps and Graphs - Programming and Data Structures - Computer Science & Information Technology previous year questions organised from real papers, with year-wise coverage and clear topic navigation.

26Papers
17Years
51Questions
1Topics

Trees, Heaps and Graphs question pattern

Every graph below is calculated only from this selection.

Questions by year

Year-wise coverage for Trees, Heaps and Graphs. Each bar uses a separate theme-derived color.

Difficulty distribution

How the classified questions are distributed by difficulty.

Easy 26 51%
Medium 24 47.1%
Hard 1 2%

Question type distribution

MCQ, numerical, multiple-select and other formats found in these papers.

MCQ 34 66.7%
Numerical Answer Type (NAT) 14 27.5%
MSQ 3 5.9%

Subject weightage

Top subjects by unique question coverage.

Computer Science & Information Technology
51 Qs

Most asked topics

Top topics across the included previous year papers.

Programming and Data Structures
51 Qs

Subtopic coverage

Top subtopics inside this exact selection.

Trees, Heaps and Graphs
51 Qs

Paper coverage

Question coverage for the most populated papers. Every active PYP paper remains listed below.

Computer Science and Information Technology (CS) 2026
4 Qs
Computer Science and Information Technology (CS) 2026
2 Qs
Computer Science & Information Technology (CS) 2025 [Session 1]
2 Qs
Computer Science & Information Technology (CS) 2025 [Session 2]
2 Qs
Computer Science & Information Technology (CS) 2024 [Session 1]
2 Qs
Computer Science & Information Technology (CS) 2024 [Session 2]
1 Qs
Computer Science & Information Technology (CS) 2023 [Session 2]
2 Qs
Computer Science & Information Technology (CS) 2022 [Session 2]
2 Qs
Computer Science & Information Technology (CS) 2021 [Session 2]
2 Qs
Computer Science & Information Technology (CS) 2021 [Session 1]
1 Qs
Computer Science & Information Technology (CS) 2020 [Session 2]
3 Qs
Computer Science & Information Technology (CS) 2019 [Session 2]
2 Qs
Computer Science & Information Technology (CS) 2018 [Session 2]
2 Qs
Computer Science & Information Technology (CS) 2017 [Session 2]
1 Qs
Computer Science & Information Technology (CS) 2016 [Session 1]
1 Qs
Computer Science & Information Technology (CS) 2016 [Session 2]
1 Qs
Computer Science & Information Technology (CS) 2014 [Session 2]
2 Qs
Computer Science & Information Technology (CS) 2014 [Session 1]
1 Qs
Computer Science & Information Technology (CS) 2014 [Session 3]
1 Qs
Computer Science & Information Technology (CS) 2013 [Session 1]
2 Qs
Computer Science & Information Technology (CS) 2013 [Session 3]
2 Qs
Computer Science & Information Technology (CS) 2013 [Session 4]
2 Qs
Computer Science & Information Technology (CS) 2010
1 Qs
Computer Science & Information Technology (CS) 2009
2 Qs
Computer Science & Information Technology (CS) 2008
2 Qs
Computer Science & Information Technology (CS) 2007
6 Qs

Included previous year papers

Newest papers appear first. Sort by year, question coverage or name.

PaperYear / sessionQuestions in this viewOpen
Computer Science and Information Technology (CS) 202620264View paper
Computer Science and Information Technology (CS) 202620262View paper
Computer Science & Information Technology (CS) 2025 [Session 1]20252View paper
Computer Science & Information Technology (CS) 2025 [Session 2]20252View paper
Computer Science & Information Technology (CS) 2024 [Session 1]20242View paper
Computer Science & Information Technology (CS) 2024 [Session 2]20241View paper
Computer Science & Information Technology (CS) 2023 [Session 2]20232View paper
Computer Science & Information Technology (CS) 2022 [Session 2]20222View paper
Computer Science & Information Technology (CS) 2021 [Session 1]20211View paper
Computer Science & Information Technology (CS) 2021 [Session 2]20212View paper
Computer Science & Information Technology (CS) 2020 [Session 2]20203View paper
Computer Science & Information Technology (CS) 2019 [Session 2]20192View paper
Computer Science & Information Technology (CS) 2018 [Session 2]20182View paper
Computer Science & Information Technology (CS) 2017 [Session 2]20171View paper
Computer Science & Information Technology (CS) 2016 [Session 1]20161View paper
Computer Science & Information Technology (CS) 2016 [Session 2]20161View paper
Computer Science & Information Technology (CS) 2014 [Session 1]20141View paper
Computer Science & Information Technology (CS) 2014 [Session 2]20142View paper
Computer Science & Information Technology (CS) 2014 [Session 3]20141View paper
Computer Science & Information Technology (CS) 2013 [Session 1]20132View paper
Computer Science & Information Technology (CS) 2013 [Session 3]20132View paper
Computer Science & Information Technology (CS) 2013 [Session 4]20132View paper
Computer Science & Information Technology (CS) 201020101View paper
Computer Science & Information Technology (CS) 200920092View paper
Computer Science & Information Technology (CS) 200820082View paper
Computer Science & Information Technology (CS) 200720076View paper

All Trees, Heaps and Graphs previous year questions

Practice every matching question in batches of 20, with every available option.

1
2007 · Computer Science & Information Technology · Programming and Data Structures · Trees, Heaps and Graphs
Computer Science & Information Technology (CS) 2007
The height of a binary tree is the maximum number of edges in any root to leaf path. The maximum number of nodes in a binary tree of height \( h \) is:
Open complete paper
2
2007 · Computer Science & Information Technology · Programming and Data Structures · Trees, Heaps and Graphs
Computer Science & Information Technology (CS) 2007

The maximum number of binary trees that can be formed with three unlabeled nodes is:

Open complete paper
3
2007 · Computer Science & Information Technology · Programming and Data Structures · Trees, Heaps and Graphs
Computer Science & Information Technology (CS) 2007
The inorder and preorder traversal of a binary tree are
d b e a f c g and a b d e c f g, respectively.
The postorder traversal of the binary tree is
Open complete paper
4
2007 · Computer Science & Information Technology · Programming and Data Structures · Trees, Heaps and Graphs
Computer Science & Information Technology (CS) 2007
A complete n-ary tree is a tree in which each node has n children or no children. Let I be the number of internal nodes and L be the number of leaves in a complete n-ary tree. If L = 41, and I = 10, what is the value of n?
Open complete paper
5
2007 · Computer Science & Information Technology · Programming and Data Structures · Trees, Heaps and Graphs
Computer Science & Information Technology (CS) 2007
Consider the following C program segment where CellNode represents a node in a binary tree:
struct CellNode {
struct CellNode *leftChild;
int element;
struct CellNode *rightChild;
};
int GetValue(struct CellNode *ptr) {
int value = 0;
if (ptr != NULL) {
if ((ptr->leftChild == NULL) &&
(ptr->rightChild == NULL))
value = 1;
else
value = value + GetValue(ptr->leftChild)
+ GetValue(ptr->rightChild);
}
return(value);
}
The value returned by GetValue when a pointer to the root of a binary tree is passed as its argument is:
Open complete paper
6
2007 · Computer Science & Information Technology · Programming and Data Structures · Trees, Heaps and Graphs
Computer Science & Information Technology (CS) 2007

Consider the process of inserting an element into a Max Heap, where the Max Heap is represented by an array. Suppose we perform a binary search on the path from the new leaf to the root to find the position for the newly inserted element, the number of comparisons performed is:

Open complete paper
7
2008 · Computer Science & Information Technology · Programming and Data Structures · Trees, Heaps and Graphs
Computer Science & Information Technology (CS) 2008
You are given the postorder traversal, P, of a binary search tree on the $n$ elements 1, 2, ..., $n$. You have to determine the unique binary search tree that has P as its postorder traversal. What is the time complexity of the most efficient algorithm for doing this?
Open complete paper
8
2008 · Computer Science & Information Technology · Programming and Data Structures · Trees, Heaps and Graphs
Computer Science & Information Technology (CS) 2008
We have a binary heap on $n$ elements and wish to insert $n$ more elements (not necessarily one after another) into this heap. The total time required for this is
Open complete paper
9
2009 · Computer Science & Information Technology · Programming and Data Structures · Trees, Heaps and Graphs
Computer Science & Information Technology (CS) 2009
What is the maximum height of any AVL-tree with 7 nodes ? Assume that the height of a tree with a single node is 0.
Open complete paper
10
2009 · Computer Science & Information Technology · Programming and Data Structures · Trees, Heaps and Graphs
Computer Science & Information Technology (CS) 2009
Which one of the following array represents a binary max-heap ?
Open complete paper
11
2010 · Computer Science & Information Technology · Programming and Data Structures · Trees, Heaps and Graphs
Computer Science & Information Technology (CS) 2010
In a binary tree with \(n\) nodes, every node has an odd number of descendants. Every node is considered to be its own descendant. What is the number of nodes in the tree that have exactly one child?
Open complete paper
12
2013 · Computer Science & Information Technology · Programming and Data Structures · Trees, Heaps and Graphs
Computer Science & Information Technology (CS) 2013 [Session 1]

Which one of the following is the tightest upper bound that represents the time complexity of inserting an object into a binary search tree of n nodes?

Open complete paper
13
2013 · Computer Science & Information Technology · Programming and Data Structures · Trees, Heaps and Graphs
Computer Science & Information Technology (CS) 2013 [Session 1]
The preorder traversal sequence of a binary search tree is 30, 20, 10, 15, 25, 23, 39, 35, 42. Which one of the following is the postorder traversal sequence of the same tree?
Open complete paper
14
2014 · Computer Science & Information Technology · Programming and Data Structures · Trees, Heaps and Graphs
Computer Science & Information Technology (CS) 2014 [Session 1]
Consider a rooted n node binary tree represented using pointers. The best upper bound on the time required to determine the number of subtrees having exactly 4 nodes is O(n^a log^b n). Then the value of a + 10b is ________.
Open complete paper
15
2014 · Computer Science & Information Technology · Programming and Data Structures · Trees, Heaps and Graphs
Computer Science & Information Technology (CS) 2014 [Session 2]
A priority queue is implemented as a Max-Heap. Initially, it has 5 elements. The level-order traversal of the heap is: 10, 8, 5, 3, 2. Two new elements 1 and 7 are inserted into the heap in that order. The level-order traversal of the heap after the insertion of the elements is:
Open complete paper
16
2014 · Computer Science & Information Technology · Programming and Data Structures · Trees, Heaps and Graphs
Computer Science & Information Technology (CS) 2014 [Session 2]
Consider the expression tree shown. Each leaf represents a numerical value, which can either be 0 or 1. Over all possible choices of the values at the leaves, the maximum possible value of the expression represented by the tree is ____.
Open complete paper
17
2014 · Computer Science & Information Technology · Programming and Data Structures · Trees, Heaps and Graphs
Computer Science & Information Technology (CS) 2014 [Session 3]
Consider the pseudocode given below. The function DoSomething() takes as argument a pointer to the root of an arbitrary tree represented by the leftMostChild-rightSibling representation. Each node of the tree is of type treeNode. typedef struct treeNode* treeptr; struct treeNode { treeptr leftMostChild, rightSibling; }; int DoSomething (treeptr tree) { int value=0; if (tree != NULL) { if (tree->leftMostChild == NULL) value = 1; else value = DoSomething(tree->leftMostChild); value = value + DoSomething(tree->rightSibling); } return(value); } When the pointer to the root of a tree is passed as the argument to DoSomething, the value returned by the function corresponds to the
Open complete paper
18
2016 · Computer Science & Information Technology · Programming and Data Structures · Trees, Heaps and Graphs
Computer Science & Information Technology (CS) 2016 [Session 1]
An operator delete(i) for a binary heap data structure is to be designed to delete the item in the i-th node. Assume that the heap is implemented in an array and i refers to the i-th index of the array. If the heap tree has depth d (number of edges on the path from the root to the farthest leaf), then what is the time complexity to re-fix the heap efficiently after the removal of the element?
Open complete paper
19
2017 · Computer Science & Information Technology · Programming and Data Structures · Trees, Heaps and Graphs
Computer Science & Information Technology (CS) 2017 [Session 2]
The pre-order traversal of a binary search tree is given by 12, 8, 6, 2, 7, 9, 10, 16, 15, 19, 17, 20. Then the post-order traversal of this tree is:
Open complete paper
20
2018 · Computer Science & Information Technology · Programming and Data Structures · Trees, Heaps and Graphs
Computer Science & Information Technology (CS) 2018 [Session 2]
The postorder traversal of a binary tree is 8,9,6,7,4,5,2,3,1. The inorder traversal of the same tree is 8,6,9,4,7,2,5,1,3. The height of a tree is the length of the longest path from the root to any leaf. The height of the binary tree above is _____.
Open complete paper

Showing 20 of 46 questions