Deck 11: Binary Trees and B-Trees

ملء الشاشة (f)
exit full mode
سؤال
When data is being organized, a programmer's highest priority is to organize it in such a way that item insertion, deletion, and lookups (searches) are fast.
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
Because an array is not a random access data structure, we cannot use a binary search to effectively find and retrieve an item from an array list.
سؤال
In an array, item insertion (especially if the array is sorted) and item deletion can be very time consuming, especially if the list size is very large.
سؤال
Item insertion and deletion in a linked list requires significant data movement.
سؤال
A sequential search is good only for very small lists because the average search length of a sequential search is half the size of the list.
سؤال
Every node in a binary tree has at most three children.
سؤال
A binary tree is a dynamic data structure.
سؤال
After inserting an item in a binary search tree, the resulting binary tree must also be a binary search tree.
سؤال
In a preorder traversal of a binary tree, for each node, first the node is visited, then the right subtree is visited, and then the left subtree is visited.
سؤال
In a preorder traversal of a binary tree, after visiting a node and before moving to the right subtree, we must save a pointer to the node so that after visiting the right subtree, we can visit the left subtree.
سؤال
As in the case of an inorder traversal, in a postorder traversal, the first node visited is the rightmost node of the binary tree.
سؤال
To specify a function as a formal parameter to another function, we specify the function type, followed by the function name as a pointer, followed by the parameter types of the function.
سؤال
The performance of the search algorithm on a binary search tree depends on how large the binary tree is.
سؤال
Because an AVL tree is a binary search tree, the search algorithm for an AVL tree is the same as the search algorithm for a binary search tree.
سؤال
Operations, such as finding the height, determining the number of nodes, checking whether the tree is empty, tree traversal, and so on, on AVL trees cannot be implemented the same way they are implemented on binary trees.
سؤال
After inserting (or deleting) a node from an AVL tree, the resulting binary tree does not have to be an AVL tree.
سؤال
To insert an item in an AVL tree, first we search the tree and find the place where the new item is to be inserted.
سؤال
After inserting the node, the reconstruction can occur at any node on the path back to the root node.
سؤال
The performance of a binary search tree depends on the width of the tree.
سؤال
Each node should store the number of keys in the node, the records, and the pointer to subtrees.
سؤال
The class implementing the properties of a B-tree must, among others, implement the search, traversal, insertion, and deletion algorithms.
سؤال
A search in a B-tree must start at the bottom node.
سؤال
When inserting into a B-tree, if the key is already in the tree, you should output an error message.
سؤال
To implement the insertion algorithm in a B-tree, we only need algorithms to split a node and insert an item into a node.
سؤال
When deleting from a B-tree, if the leaf contains only the minimum number of keys, look at the sibling nodes that are adjacent to the leaf.
سؤال
To speed up item insertion and deletion in a data set, use ____.

A) arrays
B) linked lists
C) classes
D) ADTs
سؤال
One of the drawbacks of linked lists is that they must be processed ____.

A) recursively
B) in order
C) out of order
D) sequentially
سؤال
The item insertion, deletion, and lookup operations require that the binary tree be ____.

A) duplicated
B) traversed
C) inverted
D) converted
سؤال
In a ____ traversal of a binary tree, for each node, first the left subtree is visited, then the right subtree is visited, and then the node is visited.

A) preorder
B) inorder
C) postorder
D) recursive
سؤال
In C++, a function name without any parentheses is considered a ____.

A) reference to the function
B) address of the function
C) pointer to an entry point
D) pointer to the function
سؤال
The ____ is one in which the resulting binary search is nearly balanced.

A) ABL tree
B) AVL tree
C) BVL tree
D) BDL tree
سؤال
The balance factor of x, written bf(x), is defined by ____.

A) bf(x)= xl - x1
B) bf(x)= x1 - xh
C) bf(x)= xh - x1
D) bf(x)= l(xh) - l(x1)
سؤال
Let x be a node in a binary tree, then we say that the node x violates the ____ if |xh - x1| > 1, that is, the heights of the left and right subtrees of x differ by more than 1.

A) balance criteria
B) balance factor
C) rebalance criteria
D) rebalance factor
سؤال
If the item to be inserted in an AVL tree is already in the tree, the search ends at a ____.

A) leaf node
B) linear subtree
C) linked subtree
D) nonempty subtree
سؤال
There are two types of AVL tree rotations: ____.

A) left rotation and right rotation
B) inner rotation and outer rotation
C) inner rotation and left rotation
D) right rotation and left inversion
سؤال
The reconstruction procedure for an AVL tree is called ____.

A) reverting the tree
B) balancing the tree
C) rotating the tree
D) inverting the tree
سؤال
To delete a node, we adjust one of the pointers of the ____.

A) leaf node
B) parent node
C) branch node
D) child node
سؤال
In the worst case, the height of an AVL tree with n nodes is approximately ____.

A) (1.44)logn
B) (1.44)nlogn
C) (1.44)log2n
D) (1.44)logn2
سؤال
The height of a perfectly balanced binary tree with n nodes is ____.

A) logn
B) n2
C) nlogn
D) log2n
سؤال
An ____ is a tree in which each node has at most m children.

A) m-way search tree
B) m-level search tree
C) m-node search tree
D) m-height search tree
سؤال
In a ____ the root has at least 2 children if it is not a leaf, and at most m children.

A) B-tree of height m
B) B-tree of level m
C) B-tree of size m
D) B-tree of order m
سؤال
The basic operations performed on a B-tree are search the tree, insert an item in the tree, delete an item from the tree, and ____.

A) rotate the tree
B) balance the tree
C) traverse the tree
D) copy the tree
سؤال
The function ____ searches the binary search tree for a given item.

A) insert
B) search
C) replace
D) traverse
سؤال
A B-tree can be ____ in three ways: inorder, preorder, and postorder.

A) copied
B) reversed
C) traversed
D) inversed
سؤال
When inserting into a B-tree, if the key is not in the tree, the search terminates at a ____.

A) leaf
B) root
C) node
D) branch
سؤال
When inserting into a B-tree, if the leaf is full, split the node into two nodes and the median key is moved to the ____ node.

A) child
B) empty
C) adjacent
D) parent
سؤال
Because the insertion of an item might require the splitting of a node and moving the median key to the parent node, the simplest way to implement the insertion algorithm is to use ____.

A) recursion
B) iteration
C) inversion
D) sequential traversal
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/47
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 11: Binary Trees and B-Trees
1
When data is being organized, a programmer's highest priority is to organize it in such a way that item insertion, deletion, and lookups (searches) are fast.
True
2
Because an array is not a random access data structure, we cannot use a binary search to effectively find and retrieve an item from an array list.
False
3
In an array, item insertion (especially if the array is sorted) and item deletion can be very time consuming, especially if the list size is very large.
True
4
Item insertion and deletion in a linked list requires significant data movement.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
5
A sequential search is good only for very small lists because the average search length of a sequential search is half the size of the list.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
6
Every node in a binary tree has at most three children.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
7
A binary tree is a dynamic data structure.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
8
After inserting an item in a binary search tree, the resulting binary tree must also be a binary search tree.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
9
In a preorder traversal of a binary tree, for each node, first the node is visited, then the right subtree is visited, and then the left subtree is visited.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
10
In a preorder traversal of a binary tree, after visiting a node and before moving to the right subtree, we must save a pointer to the node so that after visiting the right subtree, we can visit the left subtree.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
11
As in the case of an inorder traversal, in a postorder traversal, the first node visited is the rightmost node of the binary tree.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
12
To specify a function as a formal parameter to another function, we specify the function type, followed by the function name as a pointer, followed by the parameter types of the function.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
13
The performance of the search algorithm on a binary search tree depends on how large the binary tree is.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
14
Because an AVL tree is a binary search tree, the search algorithm for an AVL tree is the same as the search algorithm for a binary search tree.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
15
Operations, such as finding the height, determining the number of nodes, checking whether the tree is empty, tree traversal, and so on, on AVL trees cannot be implemented the same way they are implemented on binary trees.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
16
After inserting (or deleting) a node from an AVL tree, the resulting binary tree does not have to be an AVL tree.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
17
To insert an item in an AVL tree, first we search the tree and find the place where the new item is to be inserted.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
18
After inserting the node, the reconstruction can occur at any node on the path back to the root node.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
19
The performance of a binary search tree depends on the width of the tree.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
20
Each node should store the number of keys in the node, the records, and the pointer to subtrees.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
21
The class implementing the properties of a B-tree must, among others, implement the search, traversal, insertion, and deletion algorithms.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
22
A search in a B-tree must start at the bottom node.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
23
When inserting into a B-tree, if the key is already in the tree, you should output an error message.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
24
To implement the insertion algorithm in a B-tree, we only need algorithms to split a node and insert an item into a node.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
25
When deleting from a B-tree, if the leaf contains only the minimum number of keys, look at the sibling nodes that are adjacent to the leaf.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
26
To speed up item insertion and deletion in a data set, use ____.

A) arrays
B) linked lists
C) classes
D) ADTs
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
27
One of the drawbacks of linked lists is that they must be processed ____.

A) recursively
B) in order
C) out of order
D) sequentially
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
28
The item insertion, deletion, and lookup operations require that the binary tree be ____.

A) duplicated
B) traversed
C) inverted
D) converted
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
29
In a ____ traversal of a binary tree, for each node, first the left subtree is visited, then the right subtree is visited, and then the node is visited.

A) preorder
B) inorder
C) postorder
D) recursive
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
30
In C++, a function name without any parentheses is considered a ____.

A) reference to the function
B) address of the function
C) pointer to an entry point
D) pointer to the function
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
31
The ____ is one in which the resulting binary search is nearly balanced.

A) ABL tree
B) AVL tree
C) BVL tree
D) BDL tree
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
32
The balance factor of x, written bf(x), is defined by ____.

A) bf(x)= xl - x1
B) bf(x)= x1 - xh
C) bf(x)= xh - x1
D) bf(x)= l(xh) - l(x1)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
33
Let x be a node in a binary tree, then we say that the node x violates the ____ if |xh - x1| > 1, that is, the heights of the left and right subtrees of x differ by more than 1.

A) balance criteria
B) balance factor
C) rebalance criteria
D) rebalance factor
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
34
If the item to be inserted in an AVL tree is already in the tree, the search ends at a ____.

A) leaf node
B) linear subtree
C) linked subtree
D) nonempty subtree
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
35
There are two types of AVL tree rotations: ____.

A) left rotation and right rotation
B) inner rotation and outer rotation
C) inner rotation and left rotation
D) right rotation and left inversion
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
36
The reconstruction procedure for an AVL tree is called ____.

A) reverting the tree
B) balancing the tree
C) rotating the tree
D) inverting the tree
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
37
To delete a node, we adjust one of the pointers of the ____.

A) leaf node
B) parent node
C) branch node
D) child node
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
38
In the worst case, the height of an AVL tree with n nodes is approximately ____.

A) (1.44)logn
B) (1.44)nlogn
C) (1.44)log2n
D) (1.44)logn2
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
39
The height of a perfectly balanced binary tree with n nodes is ____.

A) logn
B) n2
C) nlogn
D) log2n
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
40
An ____ is a tree in which each node has at most m children.

A) m-way search tree
B) m-level search tree
C) m-node search tree
D) m-height search tree
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
41
In a ____ the root has at least 2 children if it is not a leaf, and at most m children.

A) B-tree of height m
B) B-tree of level m
C) B-tree of size m
D) B-tree of order m
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
42
The basic operations performed on a B-tree are search the tree, insert an item in the tree, delete an item from the tree, and ____.

A) rotate the tree
B) balance the tree
C) traverse the tree
D) copy the tree
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
43
The function ____ searches the binary search tree for a given item.

A) insert
B) search
C) replace
D) traverse
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
44
A B-tree can be ____ in three ways: inorder, preorder, and postorder.

A) copied
B) reversed
C) traversed
D) inversed
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
45
When inserting into a B-tree, if the key is not in the tree, the search terminates at a ____.

A) leaf
B) root
C) node
D) branch
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
46
When inserting into a B-tree, if the leaf is full, split the node into two nodes and the median key is moved to the ____ node.

A) child
B) empty
C) adjacent
D) parent
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
47
Because the insertion of an item might require the splitting of a node and moving the median key to the parent node, the simplest way to implement the insertion algorithm is to use ____.

A) recursion
B) iteration
C) inversion
D) sequential traversal
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.