CIS22C Ch 24 Tree Implementation

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

A binary tree node references another binary tree

False

Implementing binary tree traversals as iterators makes the code less flexible for the client

False

The preorder traversal of a binary tree and a general tree are different

False

You cannot use a binary tree to represent a general tree.

False

A complete traversal of an n-node binary tree is a O(n) operation if visiting a node is _____for the iterative implementation. a. O(1) b. O(log n) c. O(ln) d. O(n2 )

O(1)

A complete traversal of an n-node binary tree is a O(n) operation if visiting a node is _____for the recursive implementation. a. O(1) b. O(log n) c. O(ln) d. O(n2 )

O(1)

A complete traversal of an n-node binary tree is a(n) _____ operation if visiting a node is O(1) for the iterative implementation. a. O(n) b. O(1) c. O(log n) d. O(n2

O(n)

A complete traversal of an n-node binary tree is a(n) _____ operation if visiting a node is O(1) for the recursive implementation. a. O(n) b. O(1) c. O(log n) d. O(n2 )

O(n)

A node in a general tree is an object that references it children and a data object.

True

A node object in a binary tree references other nodes in the tree.

True

An iterator object that has not traversed the entire binary tree can be adversely affected by changes to the tree

True

The most common implementation of a tree uses a linked structure.

True

The postorder traversal of a general tree is the same as the inorder traversal of a binary tree.

True

Typically, details of the class that represents a node in a tree are hidden from the client.

True

You can derive an expression tree from the class of basic binary trees

True

The postorder traversal of a general tree is the same as the _____ traversal of a binary tree. a. inorder b. postorder c. preorder d. level order

inorder

The most common implementation of a tree uses a(n) a. linked structure b. array c. bag d. priority queue

linked structure

The elements in a tree are called a. nodes b. search keys c. entries d. indexes

nodes

The preorder traversal of a general tree is the same as the _____ traversal of a binary tree. a. preorder b. postorder c. inorder d. level order

preorder

An iterative version of an level order traversal for a binary tree uses a(n) a. queue b. priority queue c. stack d. bag

queue

An iterative version of an inorder traversal for a binary tree uses a(n) a. stack b. queue c. priority queue d. bag

stack

An iterative version of an postorder traversal for a binary tree uses a(n) a. stack b. queue c. priority queue d. bag

stack

An iterative version of an preorder traversal for a binary tree uses a(n) a. stack b. queue c. priority queue d. bag

stack

In a binary tree, if both the left and right child of a node are null a. the node is a leaf b. the node is the root of the tree c. the node is invalid d. the node contains the key-value pair being searched for

the node is a leaf

A node in a binary tree is an object that references a data object and a. two child nodes in the tree b. a linked list containing the child nodes c. a vector containing the list of child nodes d. none of the above

two child nodes in the tree

Given the following binary expression tree, what value is returned from the method evaluate in the class ExpressionTree if w = 7, x = 2, y = 1, and z = 8? a. 64 b. 16 c. 15 d. 57

64


Kaugnay na mga set ng pag-aaral

PSYC Revel Quiz 4.1-4.2 (What Is Consciousness?)

View Set

INFX 240 Chapter 1 TestOut Review

View Set

Renaissance and Baroque Art Midterm 1

View Set

CPCU 551- Addressing Commercial Property Risk

View Set

Nur210: Exam 2 Study Questions Online ATI

View Set

Microbiology: Gram-Negative Bacilli

View Set