BTE320 Chapter 19

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

The key of the right child below the root node of a search binary tree is 40. The value in the root node could be ____. a. 30 b. 40 c. 50 d. 60

a. 30

In a binary tree, the level of the children of the root node is ____. a. 0 b. 1 c. 2 d. 3

b. 1

Each link in a binary tree node points to a(n) ____ of that node. a. parent b. child c. value d. sibling

b. child

The ____ of a node in a binary tree is the number of branches on the path from the root to the node. a. height b. level c. width d. size

b. level

The listing of the nodes produced by the postorder traversal of a binary tree is called the ____. a. postsequence b. postorder sequence c. postorder table d. post-script

b. postorder sequence

In copying a binary tree, if you use just the value of the pointer of the root node, you get a ____ copy of the data. a. static b. shallow c. deep d. local

b. shallow

Assume the key of the left child below the root node of a binary search tree is 30. The value in the root node could be ____. a. 0 b. 10 c. 30 d. 40

d. 40

In the diagram of a binary tree, an arrow is called a(n) ____. a. relation b. path c. directed line d. directed branch

d. directed branch

A binary tree has a special node called the ____ node. a. super b. root c. superparent d. rootleaf

root

After inserting an item in a binary search tree, the resulting binary tree must be a(n) ____________________.

ANSWER: binary search tree

In addition to the inorder, preorder, and postorder traversals, a binary tree can also be traversed level-by-level, which is also known as ____________________ traversal.

ANSWER: breadth first breadth-first

When a class object is passed by value, the ____________________ constructor copies the value of the actual parameters into the formal parameters.

ANSWER: copy

The ____________________ of a binary tree is the number of nodes on the longest path from the root to a leaf.

ANSWER: height

In a(n) ____________________ traversal, the binary tree is traversed as follows: 1. Traverse the left subtree 2. Visit the node 3. Traverse the right subtree

ANSWER: inorder

The ____________________ of a path in a binary tree is the number of branches on that path.

ANSWER: length

Let T be a binary search tree with n nodes, in which n > 0. When T is linear, the search algorithm makes ____________________ key comparisons, in the unsuccessful case.

ANSWER: n

In a(n) ____________________ traversal, the binary tree is traversed as follows: 1. Visit the node. 2. Traverse the left subtree. 3. Traverse the right subtree.

ANSWER: preorder

The listing of the nodes produced by the preorder traversal of a binary tree is called the ____________________.

ANSWER: preorder sequence

1. In a binary tree, the branches go only from a child to a parent. a. True b. False

False

All binary tree traversals start at the left-most child node. a. True b. False

False

Duplicates are allowed in a binary search tree. a. True b. False

False

The level of the root node of a binary tree is 1. a. True b. False

False

The operations to do inorder, preorder, and postorder traversals of a binary search tree are the same as those for a binary tree. a. True b. False

True

To delete an item from the binary search tree, you must do the following: 1. Find the node containing the item (if any) to be deleted. 2. Delete the node. a. True b. False

True

Consider that A is a binary tree, C and D are the subtrees of A. Which of the following statements is always true? a. C and D are binary trees. b. C and D are search binary trees. c. C and D are empty trees. d. A is empty.

a. C and D are binary trees.

In a binary search tree, the data in each node is ____ the data in the left child. a. larger than b. smaller than c. equal to d. larger or equal to

a. larger than

The search function searches the binary search tree for a given item. If the item is found in the binary search tree, it returns ____. a. true b. false c. a reference to the node where the item was found d. 1

a. true

The sequence of operations in a postorder traversal is ____. a. traverse left; traverse right b. traverse left; traverse right; visit c. visit; traverse left; traverse right d. traverse left; visit; traverse right

b. traverse left; traverse right; visit

Every node in a binary tree has ____ pointers. a. one b. two c. three d. four

b. two

Every node in a binary tree has at most ____ children. a. one b. two c. three d. four

b. two

In a diagram of a binary tree, each node is represented as a(n) ____. a. line b. triangle c. circle d. rectangle

c. circle

A binary tree is also a(n) ____. a. stack b. linked list c. graph d. array

c. graph

After deleting the desired item from a binary search tree, the resulting tree must be a binary search tree. a. True b. False

True

For classes with pointer data members, you must explicitly overload the assignment operator and include the destructor. a. True b. False

True

In C++, a function name without any parentheses is considered a pointer to the function. a. True b. False

True

The item search, insertion, and deletion operations all require the binary tree to be traversed. a. True b. False

True

A node in a binary tree is called a(n) ____ if it has no left and right children. a. edge b. branch c. leaf d. path

c. leaf

A pointer to the root node of the binary tree is stored outside the binary tree in a pointer variable, usually called the ____. a. node b. parent c. root d. nodeType

c. root

The three traversal algorithms discussed for binary trees are ____, ____, and ____. a. order, preorder, postorder b. in, preorder, order c. order, preorder, post d. inorder, preorder, postorder

d. inorder, preorder, postorde

Three lines at the end of an arrow in the diagram of a binary tree indicate that the subtree ____. a. has three branches b. has three children c. is full d. is empty

d. is empty

A binary tree is empty if root is ____. a. '0' b. 1 c. "zero" d. nullptr

d. nullptr

When traversing a binary tree, the pointer current is initialized to ____. a. nullptr b. llink c. rlink d. root

d. root

The most common operation performed on a binary tree is a(n) ____. a. insertion b. deletion c. search d. traversal

d. traversal


Ensembles d'études connexes

EXAM 2 - Infant Child Development

View Set

BUSINESS MANAGEMENT + ADMINISTRATION CAREER CLUSTER

View Set

How Does Evolution Relate to Influenza?

View Set

Chapter. 25- Muscle Relaxants (Pharm)

View Set

Seeley's Anatomy & Physiology Midterm 4 Ch 13-16

View Set