6 Trees

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

What is the sequence of ordering for the nodes of the following BST? Binary tree with root node 250. 250's left child is 200 and right child is 300. 200's left child is 190 and right child is 210. 300's left child is 290 and right child is 310. 190 ⇢ 210 ⇢ 200 ⇢ 250 ⇢ 300 ⇢ 290 ⇢ 310 190 ⇢ 210 ⇢ 290 ⇢ 310 ⇢ 200 ⇢ 300 ⇢ 250 250 ⇢ 200 ⇢ 300 ⇢ 190 ⇢ 210 ⇢ 290 ⇢ 310 190 ⇢ 200 ⇢ 210 ⇢ 250 ⇢ 290 ⇢ 300 ⇢310

190 ⇢ 200 ⇢ 210 ⇢ 250 ⇢ 290 ⇢ 300 ⇢310 6.3.3: A BST may yield faster searches than a list.

Identify the depth of node Q. Binary tree with root node A. A's left child is X and right child is Y. X's left child is P and right child is Q. 0 1 2 3

2

Identify the sequence of nodes that are visited to search for 150. Binary tree with root node 250. 250's left child is 200 and right child is 300. 200's left child is 190 and right child is 210. 300's left child is 290 and right child is 310. 250, 200, 190 250, 200, 190, 210 200, 190 190, 210, 290, 310

250, 200, 190

What is the depth of the "Practical.jpg" node? Binary tree with root node Students. Students's left child is Tom and right child is Mark. Tom's left child is English and right child is Math. Mark's left child is Science and right child is English. Science's left child is Practical.jpg and right child is Theory.doc. 1 2 3 4

3

What is the largest number of comparisons for searching the following BST? Binary tree with root node A. A's left child is X and right child is Y. X's left child is P and right child is Q. P's left child is F and right child is G. Q's left child is R and right child is S. 5 4 3 1

4

Identify the correct statement about binary space partitioning. Regions are always split down the middle either horizontal or vertical. Half the objects are eliminated each level while traversing down a BSP tree. BSP tree can be used to store all objects in a two-dimensional world. In animation only one region is analyzed at a time.

BSP tree can be used to store all objects in a two-dimensional world.

Identify the type of the following binary tree. Binary tree with root node X. X's left child is P and right child is Q. P's left child is F and right child is G. Q's left child is R and right child is S. Not full, complete, not perfect Full, not complete, not perfect Full, complete, not perfect Full, complete, perfect

Full, complete, perfect

Identify the type of the following binary tree. Binary tree with root node A. A's left child is X and right child is Y. X's left child is P and right child is Q. P's left child is F and right child is G. Q's left child is R and right child is S. Not full, complete, not perfect Full, not complete, not perfect Full, complete, not perfect Full, complete, perfect

Full, not complete, not perfect

What type of node is "English"? Binary tree with root node Students. Students's left child is Tom and right child is Mark. Tom's left child is English and right child is Math. Mark's left child is Science and right child is English. Science's left child is Practical.jpg and right child is Theory.doc. Root Parent Internal node Leaf

Leaf

Which of the following rules does a valid BST follow? Right subtree keys ≤ node's keys Left subtree keys ≥ node's keys Left subtree keys ≤ node's keys Right subtree keys ≤ left subtree keys

Left subtree keys ≤ node's keys 6.3 Binary search trees

What is the parent of the "Theory.doc" node? Binary tree with root node Students. Students's left child is Tom and right child is Mark. Tom's left child is English and right child is Math. Mark's left child is Science and right child is English. Science's left child is Practical.jpg and right child is Theory.doc. Science Mark Students Tom

Science

Which is an internal node? X Y P Q

X

Identify the ancestor(s) of node P. Binary tree with root node A. A's left child is X and right child is Y. X's left child is P and right child is Q. X X, A X, Y X, Y, A

X, Y, A

Which XXX completes the BST search algorithm? BSTSearch(tree, key) { cur = tree⇢root while (cur is not null) if (key == cur⇢key) return cur else XXX cur = cur⇢left else cur = cur⇢right return null } if (key < cur⇢key) if (key > cur⇢key) if (key < cur⇢left⇢key) if (key > cur⇢right⇢key)

if (key < cur⇢key) 6.4.1: BST search algorithm.

In a tree representing a file system, _____. leaf nodes represent only empty directories leaf nodes represent only non-empty directories leaf nodes represent either files or empty directories leaf nodes represent only files

leaf nodes represent either files or empty directories 6.2.1: A file system is a hierarchy that can be represented by a tree.


Set pelajaran terkait

Retail Food Market Management Old Exams

View Set

Ch.4 Health of the Individual, Family, & Community

View Set

Adult Health Chapter 49 Diabetes Mellitus EAQ Questions

View Set

(Massage Therapy) Principles and Practice- Chapter 21 Kinesiology

View Set

chapter 16 review questions, Chapter 9: Scatter Radiation and Its Control, Chapter 5 and 6 Radiography Essentials, Chapter 1 Role of the Limited X-Ray operator, Chapter 4 Basic Physics for Radiography, Chapter 10: formulating x-ray techniques questio...

View Set

Cardiovascular System. Blood, and Lymphatic Systems (HESI)

View Set