• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 1 out of 2 pages
Exam (elaborations)

Binary Trees – Data Structures and Algorithms: Exam-Ready Questions and Answers

Document preview thumbnail
Preview 1 out of 2 pages

Binary Trees – Data Structures and Algorithms: Exam-Ready Questions and Answers

Content preview

Binary Trees – Data Structures and Algorithms:
Exam-Ready Questions and Answers
LATEST UPDATE 2026/2027 | PREMIUM ACADEMIC EDITION

Exam 17 of 40 | Unit code: DSA-17 | Questions: 6 | Total marks: 30 | Answer ALL questions


Question 1: [5 marks]
Define a binary tree and the terms root, leaf, depth, height and level.

Answer:

A binary tree is a hierarchical structure in which each node has at most two children (left and
right).
• Root: the topmost node. Leaf: a node with no children.
• Depth of a node: the number of edges from the root to it.
• Height of a node: the number of edges on the longest path down to a leaf.
• Level: all nodes at the same depth.


Question 2: [5 marks]
State the maximum number of nodes at level l and in a binary tree of height h (root at level 0).

Answer:

At level l: at most 2l nodes. In a tree of height h: at most 1 + 2 + 4 + … + 2h = 2h+1 − 1 nodes.


Question 3: [5 marks]
Distinguish between full, complete and perfect binary trees.

Answer:

• Full: every node has 0 or 2 children.
• Complete: all levels are completely filled except possibly the last, which is filled from left to
right.
• Perfect: all internal nodes have two children and all leaves are at the same level.


Question 4: [4 marks]
How many nodes and how many leaves does a perfect binary tree of height 4 have?

Answer:
4+1 4
Nodes: 2 − 1 = 31. Leaves (level 4): 2 = 16.


Question 5: [5 marks]
Write a recursive function that returns the height of a binary tree. State its complexity.




Page 1 Data Structures and Algorithms • Exam 17

Document information

Uploaded on
November 9, 2026
Number of pages
2
Written in
2026/2027
Type
Exam (elaborations)
Contains
Questions & answers
$12.99

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Sold
0
Followers
0
Items
303
Last sold
-



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions