CSC-2740 Quiz 6

Ace your homework & exams now with Quizwiz!

What is the sequence of ordering for the nodes of the following BST? 250 200 300 190 210 290 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

Identify the depth of node Q. A--X--Q ----------------------------------------------------------------------------- 0 1 2 3

2

Identify the sequence of nodes that are visited to search for 150. 250 200 300 190 210 290 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? Students--Mark--Science--Practical.jpg 1 2 3 4

3

What is the largest number of comparisons for searching the following BST? ----------------------------------------------------------------------------- 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. 0 0 0 0 0 0 0 ----------------------------------------------------------------------------- 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. 0 0 0 0 0 0 0 0 0 ----------------------------------------------------------------------------- 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"? Students--Tom--English ----------------------------------------------------------------------------- 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

What is the parent of the "Theory.doc" node? Students--Mark--Science--Theory.doc ----------------------------------------------------------------------------- Science Mark Students Tom

Science

Which is an internal node? A X Y P Q ----------------------------------------------------------------------------- X Y P Q

X

Identify the ancestor(s) of node P. A--X--P ----------------------------------------------------------------------------- X X, A X, Y X, Y, A

X, 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)

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


Related study sets

Missed Questions Accident and Health State Exam Simulator

View Set

Ch. 6.9 Vulnerability Assessment

View Set

Chapter 6 Ethical and Legal Issues

View Set

Health Challenges: practice questions (Care for older adults & infection)

View Set