Deck 12: Tables and Priority Queues

ملء الشاشة (f)
exit full mode
سؤال
In an array-based implementation of the priority queue,the pqDelete operation returns the item in ______.

A)items[size]
B)items[0]
C)items[size-1]
D)items[size+1]
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
In a linear implementation of the priority queue based on a linked list,the item with the highest priority value is located ______.

A)at the beginning of the linked list
B)at the end of the linked list
C)in the middle of the linked list
D)at a random location in the linked list
سؤال
The ______ operation of the ADT table throws a TableException.

A)tableInsert
B)tableDelete
C)tableRetrieve
D)tableTraverse
سؤال
In an unsorted array-based implementation of the ADT table,the retrieval operation is ______.

A)O(1)
B)O(n)
C)O(n²)
D)O(log n)
سؤال
In an unsorted array-based implementation of the ADT table,the insertion operation is ______.

A)O(1)
B)O(n)
C)O(n²)
D)O(log n)
سؤال
Which of the following operations of the binary search tree implementation of the ADT tree is O(n)?

A)insertion
B)deletion
C)retrieval
D)traversal
سؤال
The sorted array-based implementation of the tableInsert operation is ______.

A)O(1)
B)O(log n)
C)O(n)
D)O(n²)
سؤال
The sorted reference-based implementation of the tableDelete operation is ______.

A)O(1)
B)O(log n)
C)O(n)
D)O(n²)
سؤال
A(n)______ implementation of a table is nonlinear.

A)list
B)linked list
C)binary search tree
D)array
سؤال
In the sorted linear implementation of a table,the proper position of a new item to be inserted is determined ______.

A)by the data type of the item
B)by the size of the item
C)by the value of the item
D)by the value of the search key of the item
سؤال
The first item to be removed from a priority queue is the item ______.

A)in the front of the priority queue
B)in the end the priority queue
C)with the highest value
D)with the highest priority value
سؤال
The ADT table is also known as a ______.

A)map
B)queue
C)heap
D)dictionary
سؤال
The sorted reference-based implementation of the tableInsert operation is ______.

A)O(1)
B)O(n)
C)O(n²)
D)O(log n)
سؤال
An array based implementation of an ADT is a ______ implementation.

A)vertical
B)linear
C)nonlinear
D)compound
سؤال
In an unsorted array-based implementation of a table,a new item is inserted at location ______.

A)items[size]
B)items[size-1]
C)items[size+1]
D)items[size+2]
سؤال
If the item with a given search key does not exist in a table,the tableRetrieve operation returns ______.

A)the value -1
B)the value 0
C)the value false
D)a null reference
سؤال
In a binary search tree implementation of the ADT table,the item with the highest priority value is always in the ______.

A)root of the tree
B)leftmost node of the tree
C)rightmost node of the tree
D)leftmost node at level 1 of the tree
سؤال
A heap in which the root contains the item with the largest search key is called a ______.

A)minheap
B)maxheap
C)complete heap
D)binary heap
سؤال
Which of the following is true about a linear implementation of a table?

A)the unsorted implementations must insert a new item into its proper position as determined by the value of its search key
B)the sorted implementations can insert a new item into any convenient location
C)the sorted implementations maintain a count of the current number of items in the table
D)the unsorted implementations do not maintain a count of the current number of items in the table
سؤال
A priority queue orders its items by their ______.

A)position
B)value
C)priority value
D)size
سؤال
A heap in which the root contains the item with the smallest search key is called a ______.

A)minheap
B)maxheap
C)complete heap
D)binary heap
سؤال
In an array-based implementation of a heap,the parent of the node in items[i] is always stored in ______.

A)items[i/2]
B)items[(i-1)/2]
C)items[i-2]
D)items[(i-2)/2]
سؤال
In a maxheap,the root contains a search key greater than or equal to the search key in each of its children.
سؤال
The ADT table is position-oriented.
سؤال
In an array-based implementation of a heap,the heapDelete operation is ______.

A)O(1)
B)O(n)
C)O(n²)
D)O(log n)
سؤال
A binary search tree implementation of a table is a linear implementation.
سؤال
In an unsorted reference-based implementation of a table,the tableInsert operation requires a constant time regardless of the table size.
سؤال
The heapsort is ______ in the worst case.

A)O(n)
B)O(log n)
C)O(n * log n)
D)O(n²)
سؤال
A heap is a ______.

A)general tree
B)table
C)full binary tree
D)complete binary tree
سؤال
In an array-based implementation of a heap,the number of array items that must be swapped to transform a semiheap of n nodes into a heap is ______.

A)n
B)n + 1
C)log2ⁿ
D)log2(n + 1)
سؤال
Which of the following is true about the heapsort?

A)the heapsort does not require a second array
B)the heapsort is more efficient than the mergesort in the worst case
C)the heapsort is more efficient than the mergesort in the average case
D)the heapsort is better than the quicksort in the average case
سؤال
The ADT table uses a search key to identify its items.
سؤال
The search key of an item must not change for as long as the item is stored in a table.
سؤال
The heapsort is ______ in the average case.

A)O(1)
B)O(n)
C)O(log n)
D)O(n * log n)
سؤال
In an array-based implementation of a heap,the heapInsert operation is ______.

A)O(1)
B)O(n)
C)O(n²)
D)O(log n)
سؤال
A binary search tree implementation of the ADT table is easier to understand than a linear implementation.
سؤال
A semiheap is a ______.

A)table
B)complete binary tree
C)general tree
D)full binary tree
سؤال
A sorted implementation of a table can insert a new item into any convenient location.
سؤال
In a heap,the search keys of the children of a particular node have no relationship.
سؤال
The mergesort is more efficient than the heapsort in the worst case.
سؤال
What kind of implementation of the ADT table is appropriate for retrieval-dominated applications if the maximum size of the table is NOT known?
سؤال
What is the effect of the assumption that all items in a table have distinct search keys,on the insertion operation of a table?
سؤال
What are the four categories of linear implementations of tables?
سؤال
What does the priority value in a priority queue correspond to in a heap?
سؤال
Heapsort is a sorting algorithm that uses the heap data structure.Discuss how we can use a binary search tree to sort a list of values.Why would such an algorithm not perform as efficiently as heapsort?
سؤال
What is a linear implementation?
سؤال
In the Java Collections Framework,what is the difference between a Collection and a Set?
سؤال
What is the major advantage that a heap implementation of a priority queue has over a binary search tree implementation?
سؤال
What are the two main differences between a heap and a binary search tree?
سؤال
For what kinds of situations is a linear implementation of the ADT table more efficient than a binary search tree implementation?
سؤال
The Java Collections Framework includes classes called maps such as HashMap and TreeMap.In such classes,the individual elements each have two attributes.What are they?
سؤال
What are the two possible outcomes of the tableRetrieve operation of the ADT table?
سؤال
Why is a binary search operation impractical for a reference-based implementation of the ADT table?
سؤال
How does the pqDelete operation work in a linear implementation of the priority queue based on a linked list?
سؤال
What is a semiheap?
سؤال
What are the advantages of a linear implementation of the ADT table over a binary search tree implementation?
سؤال
In an array-based implementation of the priority queue,where is the item with the highest priority value located?
سؤال
What function is performed by the tableLength operation of the ADT table?
سؤال
When implementing an ADT such as a table,one design question is how often each ADT operation is to be performed.Why do we ask ourselves this question?
سؤال
What kind of implementation of the ADT table is appropriate for retrieval-dominated applications if the maximum size of the table is known?
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/60
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 12: Tables and Priority Queues
1
In an array-based implementation of the priority queue,the pqDelete operation returns the item in ______.

A)items[size]
B)items[0]
C)items[size-1]
D)items[size+1]
C
2
In a linear implementation of the priority queue based on a linked list,the item with the highest priority value is located ______.

A)at the beginning of the linked list
B)at the end of the linked list
C)in the middle of the linked list
D)at a random location in the linked list
A
3
The ______ operation of the ADT table throws a TableException.

A)tableInsert
B)tableDelete
C)tableRetrieve
D)tableTraverse
A
4
In an unsorted array-based implementation of the ADT table,the retrieval operation is ______.

A)O(1)
B)O(n)
C)O(n²)
D)O(log n)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
5
In an unsorted array-based implementation of the ADT table,the insertion operation is ______.

A)O(1)
B)O(n)
C)O(n²)
D)O(log n)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
6
Which of the following operations of the binary search tree implementation of the ADT tree is O(n)?

A)insertion
B)deletion
C)retrieval
D)traversal
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
7
The sorted array-based implementation of the tableInsert operation is ______.

A)O(1)
B)O(log n)
C)O(n)
D)O(n²)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
8
The sorted reference-based implementation of the tableDelete operation is ______.

A)O(1)
B)O(log n)
C)O(n)
D)O(n²)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
9
A(n)______ implementation of a table is nonlinear.

A)list
B)linked list
C)binary search tree
D)array
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
10
In the sorted linear implementation of a table,the proper position of a new item to be inserted is determined ______.

A)by the data type of the item
B)by the size of the item
C)by the value of the item
D)by the value of the search key of the item
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
11
The first item to be removed from a priority queue is the item ______.

A)in the front of the priority queue
B)in the end the priority queue
C)with the highest value
D)with the highest priority value
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
12
The ADT table is also known as a ______.

A)map
B)queue
C)heap
D)dictionary
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
13
The sorted reference-based implementation of the tableInsert operation is ______.

A)O(1)
B)O(n)
C)O(n²)
D)O(log n)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
14
An array based implementation of an ADT is a ______ implementation.

A)vertical
B)linear
C)nonlinear
D)compound
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
15
In an unsorted array-based implementation of a table,a new item is inserted at location ______.

A)items[size]
B)items[size-1]
C)items[size+1]
D)items[size+2]
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
16
If the item with a given search key does not exist in a table,the tableRetrieve operation returns ______.

A)the value -1
B)the value 0
C)the value false
D)a null reference
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
17
In a binary search tree implementation of the ADT table,the item with the highest priority value is always in the ______.

A)root of the tree
B)leftmost node of the tree
C)rightmost node of the tree
D)leftmost node at level 1 of the tree
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
18
A heap in which the root contains the item with the largest search key is called a ______.

A)minheap
B)maxheap
C)complete heap
D)binary heap
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
19
Which of the following is true about a linear implementation of a table?

A)the unsorted implementations must insert a new item into its proper position as determined by the value of its search key
B)the sorted implementations can insert a new item into any convenient location
C)the sorted implementations maintain a count of the current number of items in the table
D)the unsorted implementations do not maintain a count of the current number of items in the table
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
20
A priority queue orders its items by their ______.

A)position
B)value
C)priority value
D)size
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
21
A heap in which the root contains the item with the smallest search key is called a ______.

A)minheap
B)maxheap
C)complete heap
D)binary heap
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
22
In an array-based implementation of a heap,the parent of the node in items[i] is always stored in ______.

A)items[i/2]
B)items[(i-1)/2]
C)items[i-2]
D)items[(i-2)/2]
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
23
In a maxheap,the root contains a search key greater than or equal to the search key in each of its children.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
24
The ADT table is position-oriented.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
25
In an array-based implementation of a heap,the heapDelete operation is ______.

A)O(1)
B)O(n)
C)O(n²)
D)O(log n)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
26
A binary search tree implementation of a table is a linear implementation.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
27
In an unsorted reference-based implementation of a table,the tableInsert operation requires a constant time regardless of the table size.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
28
The heapsort is ______ in the worst case.

A)O(n)
B)O(log n)
C)O(n * log n)
D)O(n²)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
29
A heap is a ______.

A)general tree
B)table
C)full binary tree
D)complete binary tree
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
30
In an array-based implementation of a heap,the number of array items that must be swapped to transform a semiheap of n nodes into a heap is ______.

A)n
B)n + 1
C)log2ⁿ
D)log2(n + 1)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
31
Which of the following is true about the heapsort?

A)the heapsort does not require a second array
B)the heapsort is more efficient than the mergesort in the worst case
C)the heapsort is more efficient than the mergesort in the average case
D)the heapsort is better than the quicksort in the average case
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
32
The ADT table uses a search key to identify its items.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
33
The search key of an item must not change for as long as the item is stored in a table.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
34
The heapsort is ______ in the average case.

A)O(1)
B)O(n)
C)O(log n)
D)O(n * log n)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
35
In an array-based implementation of a heap,the heapInsert operation is ______.

A)O(1)
B)O(n)
C)O(n²)
D)O(log n)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
36
A binary search tree implementation of the ADT table is easier to understand than a linear implementation.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
37
A semiheap is a ______.

A)table
B)complete binary tree
C)general tree
D)full binary tree
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
38
A sorted implementation of a table can insert a new item into any convenient location.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
39
In a heap,the search keys of the children of a particular node have no relationship.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
40
The mergesort is more efficient than the heapsort in the worst case.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
41
What kind of implementation of the ADT table is appropriate for retrieval-dominated applications if the maximum size of the table is NOT known?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
42
What is the effect of the assumption that all items in a table have distinct search keys,on the insertion operation of a table?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
43
What are the four categories of linear implementations of tables?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
44
What does the priority value in a priority queue correspond to in a heap?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
45
Heapsort is a sorting algorithm that uses the heap data structure.Discuss how we can use a binary search tree to sort a list of values.Why would such an algorithm not perform as efficiently as heapsort?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
46
What is a linear implementation?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
47
In the Java Collections Framework,what is the difference between a Collection and a Set?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
48
What is the major advantage that a heap implementation of a priority queue has over a binary search tree implementation?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
49
What are the two main differences between a heap and a binary search tree?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
50
For what kinds of situations is a linear implementation of the ADT table more efficient than a binary search tree implementation?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
51
The Java Collections Framework includes classes called maps such as HashMap and TreeMap.In such classes,the individual elements each have two attributes.What are they?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
52
What are the two possible outcomes of the tableRetrieve operation of the ADT table?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
53
Why is a binary search operation impractical for a reference-based implementation of the ADT table?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
54
How does the pqDelete operation work in a linear implementation of the priority queue based on a linked list?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
55
What is a semiheap?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
56
What are the advantages of a linear implementation of the ADT table over a binary search tree implementation?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
57
In an array-based implementation of the priority queue,where is the item with the highest priority value located?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
58
What function is performed by the tableLength operation of the ADT table?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
59
When implementing an ADT such as a table,one design question is how often each ADT operation is to be performed.Why do we ask ourselves this question?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
60
What kind of implementation of the ADT table is appropriate for retrieval-dominated applications if the maximum size of the table is known?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.