Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Exam (elaborations)

CMPT 280 MIDTERM EXAM QUESTIONS AND CORRECT ANSWERS

Rating
-
Sold
-
Pages
5
Grade
A+
Uploaded on
21-12-2024
Written in
2024/2025

CMPT 280 MIDTERM EXAM QUESTIONS AND CORRECT ANSWERS...

Institution
CMPT 280
Course
CMPT 280

Content preview

CMPT 280 MIDTERM EXAM QUESTIONS AND CORRECT ANSWERS



What is a heap? - Answer a binary tree which has the heap property



Name a heap property - Answer * Parent nodes have to be >= children nodes

*largest item (root) removed in delete



Define the term 'parent' in regards to a tree - Answer a direct ancestor of current node.
[directly above current node]



Define the term 'ancestor' in regards to a tree - Answer a node that comes before the
node we are currently on [path to root]



Define the term 'descendant' in regards to a tree - Answer a node that comes after the
node we are currently on [path away from root]



Identify the information that must be stored in a binary tree node - Answer *an element
of type <I>

*reference to root node of left and right subtree children



Define characteristics of a binary tree root node - Answer *it has no parent

*it can have 0-2 children



Informally describe an implementation of a binary tree within the framework of lib280 -
Answer *implement container interface [ because it collects elements]

*define methods [rootItem(), rootRightSubtree(LeftSubtree), ..etc

*create class that stores information about nodes

, describe the conditions under which nodes must be visited in a depth-first tree traversal
- Answer start at root; visit children [subtree] of visited node before visiting nodes
sibling(s) [other subtree]



identify valid depth-first traversals of trees - Answer *post-order * from left to right

*pre-order *from right to left

*in-order *in random order



describe the conditions under which nodes must be visited in a breadth-first tree
traversal - Answer start at root; visit all nodes in current level before going to next level



identify valid breadth-first traversals of trees - Answer *level order traversal [visited
from left to right]



define and identify pre-order - Answer start at root; node, left, right

*nodes visited before subtrees



define and identify post-order traversals of binary trees. - Answer start at left most
bottom; left, right, node



define and identify in-order traversals of binary trees. - Answer start at left most bottom;
left, node, right

*not a breadth-first traversal



define what an ordered binary tree is - Answer [a.k.a binary search tree] an additional
structure which arranges elements in a tree making it more efficient during searches



What properties must a ordered binary tree possess? - Answer *elements stored to the
left of a node is LESS than said node

*elements stored to the right of a node is GREATER than or equal to said node

Written for

Institution
CMPT 280
Course
CMPT 280

Document information

Uploaded on
December 21, 2024
Number of pages
5
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

$11.49
Get access to the full document:

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


Also available in package deal

Thumbnail
Package deal
CMPT 280 PACKAGED EXAMS!!
-
7 2024
$ 35.99 More info

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
Easton West Virgina University
View profile
Follow You need to be logged in order to follow users or courses
Sold
571
Member since
3 year
Number of followers
221
Documents
28055
Last sold
5 days ago

3.9

120 reviews

5
56
4
21
3
25
2
7
1
11

Recently viewed by you

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