Deck 9: Trees

ملء الشاشة (f)
exit full mode
سؤال
The predecessor of a node is called its __________.

A) sibling
B) parent
C) child
D) descendant
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
A(n) __________ of a node is a tree whose root is a child of that node.
سؤال
The height of a tree is the same as the height of its root node.
سؤال
A set of nodes T is a binary tree if either of the following is true:
• __________
• If T is not empty, it has a root node r with 0, 1, or 2 binary subtrees whose roots are connected to r by a branch.

A) T is complete
B) T is balanced
C) T is full
D) T is empty
سؤال
In an expression tree, operands are stored in the __________ node(s).

A) internal
B) leaf
C) root
D) ancestor
سؤال
To decode a file of letters and spaces, you walk down the Huffman tree, starting at the root, until you reach a(n) __________.
سؤال
Searching a binary search tree is an O(__________) process.

A) 1
B) log n
C) n
D) n log n
سؤال
A(n) complete binary tree of height h is filled up to depth __________ and, at depth h, any unfilled nodes are on the right.
سؤال
The process of walking through a tree in a prescribed order and visiting the nodes as they are encountered in known as tree __________.
سؤال
You may not define member functions in a C++ struct type.
سؤال
Complete the definition of Binary_Tree member function is_null.
template<typename Item_Type>
bool Binary_Tree<Item_Type>::is_null() const
{
/**missing code goes here*/
__________
}
سؤال
Which of the following lines completes the definition of is_leaf?
<strong>Which of the following lines completes the definition of is_leaf?  </strong> A) return root->left == NULL; B) return root->right == NULL; C) return root->left == NULL || root->right == NULL; D) return root->left == NULL && root->right == NULL; <div style=padding-top: 35px>

A) return root->left == NULL;
B) return root->right == NULL;
C) return root->left == NULL || root->right == NULL;
D) return root->left == NULL && root->right == NULL;
سؤال
A(n) __________ pointer is a class that acts like a pointer, but automatically deletes the object pointed to when the pointed-to object has no owners.
سؤال
In the worst case scenario, a search against an unbalanced binary search has a performance cost of O(__________).

A) 1
B) log n
C) n
D) n log n
سؤال
Which of the following lines completes the insert starter function?
<strong>Which of the following lines completes the insert starter function?  </strong> A) return insert(root, item); B) return insert(this->root, item); C) return insert(item); D) return insert(this, item); <div style=padding-top: 35px>

A) return insert(root, item);
B) return insert(this->root, item);
C) return insert(item);
D) return insert(this, item);
سؤال
In a binary search tree, the parent must be smaller than all of the data fields in the left subtree and larger than all of the data fields in the right subtree.
سؤال
Enable the replace_parent function to maintain a connection to the subtree originally pointed to by local_root, by using the line __________.
Enable the replace_parent function to maintain a connection to the subtree originally pointed to by local_root, by using the line __________.  <div style=padding-top: 35px>
سؤال
A(n) __________ is a substring that is delimited by a pair of delimiter characters (examples of delimiter characters are spaces and punctuation symbols).
سؤال
A heap is a complete binary tree with the following properties:
• The value in the root is greater than or equal to all items in the tree.
• __________
سؤال
Removal from a heap is always from the top.
سؤال
For a node at position p in a vector representing a heap, the left child is at __________.

A) 2p
B) 2p + 1
C) 2p + 2
D) 2p - 1
سؤال
Both heap insert and remove are O(__________), where n is the number of items in the heap.

A) log n
B) n
C) n2
D) n3
سؤال
Priority queues violate the FIFO property of an ordinary queue.
سؤال
To remove an item from the priority queue, we take the __________ item from the underlying vector container; this is the largest item.
سؤال
When using the ASCII code to make messages, the length of a message would be __________ where n is the total number of characters.

A) 8 * log n
B) 8 * n
C) 8 * n log n
D) 8 * n2
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/25
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 9: Trees
1
The predecessor of a node is called its __________.

A) sibling
B) parent
C) child
D) descendant
parent
2
A(n) __________ of a node is a tree whose root is a child of that node.
subtree
3
The height of a tree is the same as the height of its root node.
True
4
A set of nodes T is a binary tree if either of the following is true:
• __________
• If T is not empty, it has a root node r with 0, 1, or 2 binary subtrees whose roots are connected to r by a branch.

A) T is complete
B) T is balanced
C) T is full
D) T is empty
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
5
In an expression tree, operands are stored in the __________ node(s).

A) internal
B) leaf
C) root
D) ancestor
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
6
To decode a file of letters and spaces, you walk down the Huffman tree, starting at the root, until you reach a(n) __________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
7
Searching a binary search tree is an O(__________) process.

A) 1
B) log n
C) n
D) n log n
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
8
A(n) complete binary tree of height h is filled up to depth __________ and, at depth h, any unfilled nodes are on the right.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
9
The process of walking through a tree in a prescribed order and visiting the nodes as they are encountered in known as tree __________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
10
You may not define member functions in a C++ struct type.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
11
Complete the definition of Binary_Tree member function is_null.
template<typename Item_Type>
bool Binary_Tree<Item_Type>::is_null() const
{
/**missing code goes here*/
__________
}
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
12
Which of the following lines completes the definition of is_leaf?
<strong>Which of the following lines completes the definition of is_leaf?  </strong> A) return root->left == NULL; B) return root->right == NULL; C) return root->left == NULL || root->right == NULL; D) return root->left == NULL && root->right == NULL;

A) return root->left == NULL;
B) return root->right == NULL;
C) return root->left == NULL || root->right == NULL;
D) return root->left == NULL && root->right == NULL;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
13
A(n) __________ pointer is a class that acts like a pointer, but automatically deletes the object pointed to when the pointed-to object has no owners.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
14
In the worst case scenario, a search against an unbalanced binary search has a performance cost of O(__________).

A) 1
B) log n
C) n
D) n log n
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
15
Which of the following lines completes the insert starter function?
<strong>Which of the following lines completes the insert starter function?  </strong> A) return insert(root, item); B) return insert(this->root, item); C) return insert(item); D) return insert(this, item);

A) return insert(root, item);
B) return insert(this->root, item);
C) return insert(item);
D) return insert(this, item);
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
16
In a binary search tree, the parent must be smaller than all of the data fields in the left subtree and larger than all of the data fields in the right subtree.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
17
Enable the replace_parent function to maintain a connection to the subtree originally pointed to by local_root, by using the line __________.
Enable the replace_parent function to maintain a connection to the subtree originally pointed to by local_root, by using the line __________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
18
A(n) __________ is a substring that is delimited by a pair of delimiter characters (examples of delimiter characters are spaces and punctuation symbols).
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
19
A heap is a complete binary tree with the following properties:
• The value in the root is greater than or equal to all items in the tree.
• __________
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
20
Removal from a heap is always from the top.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
21
For a node at position p in a vector representing a heap, the left child is at __________.

A) 2p
B) 2p + 1
C) 2p + 2
D) 2p - 1
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
22
Both heap insert and remove are O(__________), where n is the number of items in the heap.

A) log n
B) n
C) n2
D) n3
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
23
Priority queues violate the FIFO property of an ordinary queue.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
24
To remove an item from the priority queue, we take the __________ item from the underlying vector container; this is the largest item.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
25
When using the ASCII code to make messages, the length of a message would be __________ where n is the total number of characters.

A) 8 * log n
B) 8 * n
C) 8 * n log n
D) 8 * n2
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.