Deck 19: Binary Trees
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/50
العب
ملء الشاشة (f)
Deck 19: Binary Trees
1
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
2
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.
1.Find the node containing the item (if any)to be deleted.
2.Delete the node.
True
3
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
B
4
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
5
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
6
In C++,a function name without any parentheses is considered a pointer to the function.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
7
After deleting the desired item from a binary search tree,the resulting tree must be a binary search tree.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
8
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
9
The level of the root node of a binary tree is 1.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
10
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
11
All binary tree traversals start at the left-most child node.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
13
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
14
Duplicates are allowed in a binary search tree.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
15
For classes with pointer data members,you must explicitly overload the assignment operator and include the destructor.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
16
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
17
The item search,insertion,and deletion operations all require the binary tree to be traversed.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
18
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
19
Every node in a binary tree has ____ pointers.
A) one
B) two
C) three
D) four
A) one
B) two
C) three
D) four
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
20
In a binary tree,the branches go only from a child to a parent.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
21
When traversing a binary tree with the pointer current,the pointer current is initialized to ____.
A) NULL
B) llink
C) rlink
D) root
A) NULL
B) llink
C) rlink
D) root
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
22
The ____________________ of a path in a binary tree is the number of branches on that path.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
23
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
24
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
25
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
26
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
27
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
28
A binary tree is empty if root is ____.
A) 0
B) 1
C) "zero"
D) NULL
A) 0
B) 1
C) "zero"
D) NULL
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
29
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
30
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
31
In a binary search tree,the data in each node is ____ the data in the right child.
A) equal to
B) smaller than
C) greater than
D) smaller or equal to
A) equal to
B) smaller than
C) greater than
D) smaller or equal to
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
32
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
33
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
1.Traverse the left subtree
2.Visit the node
3.Traverse the right subtree
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
34
The listing of the nodes produced by the preorder traversal of a binary tree is called the ____________________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
35
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
36
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.
1. Visit the node.
2.Traverse the left subtree.
3.Traverse the right subtree.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
37
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
38
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
B) false
C) a reference to the node where the item was found
D) 1
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
39
The ____________________ of a binary tree is the number of nodes on the longest path from the root to a leaf.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
40
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
41
When a class object is passed by value,the ____________________ constructor copies the value of the actual parameters into the formal parameters.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
42
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
43
The listing of the nodes produced by the inorder traversal of a binary tree is called the ____________________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
44
Let T be a binary search tree with n nodes,in which n > 0.The average number of nodes visited in a search of T is approximately O(____________________).
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
45
To destroy a binary tree,for each node,first we destroy its left subtree,then its right subtree,and then the node itself.We must then use the operator ____________________ to deallocate the memory occupied by the node.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
46
Let T be a binary search tree with n nodes,in which n > 0.The number of key comparisons is approximately O(____________________).
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
47
After inserting an item in a binary search tree,the resulting binary tree must be a(n)____________________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
48
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
49
1.current = root;
2.while (current is not NULL or stack is nonempty)
if (current is not NULL)
{
visit current node;
push current onto stack;
current = current->lLink;
}
else
{
current = stack.top();
pop stack;
current = current->rLink; //move to the right child
}
2.while (current is not NULL or stack is nonempty)
if (current is not NULL)
{
visit current node;
push current onto stack;
current = current->lLink;
}
else
{
current = stack.top();
pop stack;
current = current->rLink; //move to the right child
}
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
50
The algorithm below describes the nonrecursive ____________________ traversal of a binary tree.
1.current = root;
2.while (current is not NULL or stack is nonempty)
if (current is not NULL)
{
push current onto stack;
current = current->lLink;
}
else
{
current = stack.top();
pop stack;
visit current; //visit the node
current = current->rLink;//move to right child
}
1.current = root;
2.while (current is not NULL or stack is nonempty)
if (current is not NULL)
{
push current onto stack;
current = current->lLink;
}
else
{
current = stack.top();
pop stack;
visit current; //visit the node
current = current->rLink;//move to right child
}
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck