Deck 19: Binary Trees
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/43
Play
Full screen (f)
Deck 19: Binary Trees
1
In the diagram of a binary tree, an arrow is called a(n) ____.
A) relation
B) path
C) directed line
D) directed branch
A) relation
B) path
C) directed line
D) directed branch
D
2
Every node in a binary tree has at most ____ children.
A) one
B) two
C) three
D) four
A) one
B) two
C) three
D) four
B
3
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
A) edge
B) branch
C) leaf
D) path
C
4
The level of the root node of a binary tree is 1.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
5
In a binary tree, the branches go only from a child to a parent.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
6
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.
2.Delete the node.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
7
Duplicates are allowed in a binary search tree.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
8
Every node in a binary tree has ____ pointers.
A) one
B) two
C) three
D) four
A) one
B) two
C) three
D) four
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
9
For classes with pointer data members, you must explicitly overload the assignment operator and include the destructor.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
10
All binary tree traversals start at the left-most child node.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
11
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
A) has three branches
B) has three children
C) is full
D) is empty
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
12
The operations to do inorder, preorder, and postorder traversals of a binary search tree are the same as those for a binary tree.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
13
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.
B) C and D are search binary trees.
C) C and D are empty trees.
D) A is empty.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
14
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
A) node
B) parent
C) root
D) nodeType
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
15
The item search, insertion, and deletion operations all require the binary tree to be traversed.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
16
In C++, a function name without any parentheses is considered a pointer to the function.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
17
In a diagram of a binary tree, each node is represented as a(n) ____.
A) line
B) triangle
C) circle
D) rectangle
A) line
B) triangle
C) circle
D) rectangle
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
18
A binary tree has a special node called the ____ node.
A) super
B) root
C) superparent
D) rootleaf
A) super
B) root
C) superparent
D) rootleaf
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
19
After deleting the desired item from a binary search tree, the resulting tree must be a binary search tree.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
20
Each link in a binary tree node points to a(n) ____ of that node.
A) parent
B) child
C) value
D) sibling
A) parent
B) child
C) value
D) sibling
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
21
A binary tree is empty if root is ____.
A) '0'
B) 1
C) "zero"
D) nullptr
A) '0'
B) 1
C) "zero"
D) nullptr
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
22
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
A) traverse left; traverse right
B) traverse left; traverse right; visit
C) visit; traverse left; traverse right
D) traverse left; visit; traverse right
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
23
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
A) 0
B) 10
C) 30
D) 40
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
24
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
2.Visit the node
3.Traverse the right subtree
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
25
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
A) order, preorder, postorder
B) in, preorder, order
C) order, preorder, post
D) inorder, preorder, postorder
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
26
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
B) smaller than
C) equal to
D) larger or equal to
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
27
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.
2.Traverse the left subtree.
3.Traverse the right subtree.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
28
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
A) postsequence
B) postorder sequence
C) postorder table
D) post-script
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
29
A binary tree is also a(n) ____.
A) stack
B) linked list
C) graph
D) array
A) stack
B) linked list
C) graph
D) array
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
30
The listing of the nodes produced by the preorder traversal of a binary tree is called the ____________________.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
31
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.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
32
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
B) 40
C) 50
D) 60
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
33
The ____________________ of a binary tree is the number of nodes on the longest path from the root to a leaf.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
34
The search function searches the binary search tree for a given item.If the item is found in the binary search tree, it returns ____.
C) a reference to the node where the item was found
D) 1
C) a reference to the node where the item was found
D) 1
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
35
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
A) height
B) level
C) width
D) size
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
36
In a binary tree, the level of the children of the root node is ____.
A) 0
B) 1
C) 2
D) 3
A) 0
B) 1
C) 2
D) 3
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
37
The ____________________ of a path in a binary tree is the number of branches on that path.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
38
When traversing a binary tree, the pointer current is initialized to ____.
A) nullptr
B) llink
C) rlink
D) root
A) nullptr
B) llink
C) rlink
D) root
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
39
The most common operation performed on a binary tree is a(n) ____.
A) insertion
B) deletion
C) search
D) traversal
A) insertion
B) deletion
C) search
D) traversal
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
40
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
A) static
B) shallow
C) deep
D) local
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
41
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.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
42
When a class object is passed by value, the ____________________ constructor copies the value of the actual parameters into the formal parameters.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
43
After inserting an item in a binary search tree, the resulting binary tree must be a(n) ____________________.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck