Deck 19: Custom Templatized Data Structures

ملء الشاشة (f)
exit full mode
سؤال
If you have a 1000-element balanced binary search tree, what is the maximum number of comparisons that may be needed to find an element in the tree?

A) 500
B) 20
C) 10
D) 8
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
A linked list has the functions insertAtFront, removeFromFront, insertAtBack and removeFromBack, which perform operations on nodes exactly as their names describe. Which two functions would most naturally model the enqueue and dequeue operations, respectively, of a queue?

A) insertAtBack and removeFromBack.
B) insertAtBack and removeFromFront.
C) removeFromFront and insertAtFront.
D) removeFromFront and insertAtBack.
سؤال
How many pointers are contained as data members in the nodes of a circular, doubly linked list of integers with five nodes?

A) 5
B) 8
C) 10
D) 15
سؤال
What kind of linked list begins with a pointer to the first node, and each node contains a pointer to the next node, and the pointer in the last node points back to the first node?

A) Circular, singly-linked list.
B) Circular, doubly-linked list.
C) Singly-linked list.
D) Doubly-linked list.
سؤال
Which of the following is a self-referential object?

A) class SelfRefer {
Int* xPtr;
};
B) class selfRefer {
SelfRefer x;
};
C) class SelfRefer {
SelfRefer* xPtr;
};
D) class SelfRefer1 {
SelfRefer2 x;
};
Class SelfRefer2
{
SelfRefer1 x;
};
سؤال
Which data structure represents a waiting line and limits insertions to be made at the back of the data structure and limits removals to be made from the front?

A) Stack.
B) Queue.
C) Binary tree.
D) Linked list.
سؤال
A queue performs the following commands (in pseudo-code): enqueue 4, 6, 8, 3, 1
Dequeue three elements
Enqueue 3, 1, 5, 6
Dequeue two elements
What number is now at the front of the queue?

A) 3
B) 4
C) 5
D) 6
سؤال
The pointer member in a self-referential class is referred to as a:

A) Link.
B) Connector.
C) Tie.
D) Referrer.
سؤال
For a non-empty linked list, select the code that should appear in a function that adds a node to the end of the list. newPtr is a pointer to the new node to be added and lastPtr is a pointer to the current last node. Each node contains a pointer nextPtr.

A) lastPtr->nextPtr = newPtr; lastPtr = newPtr
B) lastPtr = newPtr; lastPtr->nextPtr = newPtr
C) newPtr->nextPtr = lastPtr; lastPtr = newPtr
D) lastPtr = newPtr; newPtr->nextPtr = lastPtr
سؤال
Select the incorrect statement. Binary search trees (regardless of the order in which the values are inserted into the tree):

A) Always have multiple links per node.
B) Can be sorted efficiently.
C) Always have the same shape for a particular set of data.
D) Are nonlinear data structures.
سؤال
A stack is initially empty, then the following commands are performed: push 5
Push 7
Pop
Push 10
Push 5
Pop
Which of the following is the correct stack after those commands (assume the top of the stack is on the left)?

A) 5 10 7 5
B) 5 10
C) 7 5
D) 10 5
سؤال
Which of the following is not a dynamic data structure?

A) Linked list.
B) Stack.
C) Array.
D) Binary tree.
سؤال
__________ is not an advantage of linked lists when compared to arrays.

A) Dynamic memory allocation.
B) Efficient insertion and deletion.
C) Direct access to any list element.
D) No need to allocate extra space, "just in case."
سؤال
In general, linked lists allow:

A) Insertions and removals anywhere.
B) Insertions and removals only at one end.
C) Insertions at the back and removals from the front.
D) None of the above.
سؤال
Which of the following statements about stacks is incorrect?

A) Stacks can be implemented using linked lists.
B) Stacks are first-in, first-out (FIFO) data structures.
C) New nodes can only be added to the top of the stack.
D) The last node (at the bottom) of a stack has a null (0) link.
سؤال
Which of the following tasks would a binary search tree not be well suited for?

A) Duplicate elimination.
B) Searching.
C) Sorting.
D) Reversing an unsorted sequence.
سؤال
If you add the following nodes to a binary search tree in the order they appear (left-to-right): 6 34 17 19 16 10 23 3
What will be the output of a postorder traversal of the resulting tree?

A) 3 10 16 23 19 17 34 6
B) 3 6 17 16 10 19 23 34
C) 6 3 34 17 16 10 19 23
D) 10 16 23 19 17 34 3 6
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/17
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 19: Custom Templatized Data Structures
1
If you have a 1000-element balanced binary search tree, what is the maximum number of comparisons that may be needed to find an element in the tree?

A) 500
B) 20
C) 10
D) 8
C
2
A linked list has the functions insertAtFront, removeFromFront, insertAtBack and removeFromBack, which perform operations on nodes exactly as their names describe. Which two functions would most naturally model the enqueue and dequeue operations, respectively, of a queue?

A) insertAtBack and removeFromBack.
B) insertAtBack and removeFromFront.
C) removeFromFront and insertAtFront.
D) removeFromFront and insertAtBack.
B
3
How many pointers are contained as data members in the nodes of a circular, doubly linked list of integers with five nodes?

A) 5
B) 8
C) 10
D) 15
C
4
What kind of linked list begins with a pointer to the first node, and each node contains a pointer to the next node, and the pointer in the last node points back to the first node?

A) Circular, singly-linked list.
B) Circular, doubly-linked list.
C) Singly-linked list.
D) Doubly-linked list.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 17 في هذه المجموعة.
فتح الحزمة
k this deck
5
Which of the following is a self-referential object?

A) class SelfRefer {
Int* xPtr;
};
B) class selfRefer {
SelfRefer x;
};
C) class SelfRefer {
SelfRefer* xPtr;
};
D) class SelfRefer1 {
SelfRefer2 x;
};
Class SelfRefer2
{
SelfRefer1 x;
};
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 17 في هذه المجموعة.
فتح الحزمة
k this deck
6
Which data structure represents a waiting line and limits insertions to be made at the back of the data structure and limits removals to be made from the front?

A) Stack.
B) Queue.
C) Binary tree.
D) Linked list.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 17 في هذه المجموعة.
فتح الحزمة
k this deck
7
A queue performs the following commands (in pseudo-code): enqueue 4, 6, 8, 3, 1
Dequeue three elements
Enqueue 3, 1, 5, 6
Dequeue two elements
What number is now at the front of the queue?

A) 3
B) 4
C) 5
D) 6
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 17 في هذه المجموعة.
فتح الحزمة
k this deck
8
The pointer member in a self-referential class is referred to as a:

A) Link.
B) Connector.
C) Tie.
D) Referrer.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 17 في هذه المجموعة.
فتح الحزمة
k this deck
9
For a non-empty linked list, select the code that should appear in a function that adds a node to the end of the list. newPtr is a pointer to the new node to be added and lastPtr is a pointer to the current last node. Each node contains a pointer nextPtr.

A) lastPtr->nextPtr = newPtr; lastPtr = newPtr
B) lastPtr = newPtr; lastPtr->nextPtr = newPtr
C) newPtr->nextPtr = lastPtr; lastPtr = newPtr
D) lastPtr = newPtr; newPtr->nextPtr = lastPtr
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 17 في هذه المجموعة.
فتح الحزمة
k this deck
10
Select the incorrect statement. Binary search trees (regardless of the order in which the values are inserted into the tree):

A) Always have multiple links per node.
B) Can be sorted efficiently.
C) Always have the same shape for a particular set of data.
D) Are nonlinear data structures.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 17 في هذه المجموعة.
فتح الحزمة
k this deck
11
A stack is initially empty, then the following commands are performed: push 5
Push 7
Pop
Push 10
Push 5
Pop
Which of the following is the correct stack after those commands (assume the top of the stack is on the left)?

A) 5 10 7 5
B) 5 10
C) 7 5
D) 10 5
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 17 في هذه المجموعة.
فتح الحزمة
k this deck
12
Which of the following is not a dynamic data structure?

A) Linked list.
B) Stack.
C) Array.
D) Binary tree.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 17 في هذه المجموعة.
فتح الحزمة
k this deck
13
__________ is not an advantage of linked lists when compared to arrays.

A) Dynamic memory allocation.
B) Efficient insertion and deletion.
C) Direct access to any list element.
D) No need to allocate extra space, "just in case."
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 17 في هذه المجموعة.
فتح الحزمة
k this deck
14
In general, linked lists allow:

A) Insertions and removals anywhere.
B) Insertions and removals only at one end.
C) Insertions at the back and removals from the front.
D) None of the above.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 17 في هذه المجموعة.
فتح الحزمة
k this deck
15
Which of the following statements about stacks is incorrect?

A) Stacks can be implemented using linked lists.
B) Stacks are first-in, first-out (FIFO) data structures.
C) New nodes can only be added to the top of the stack.
D) The last node (at the bottom) of a stack has a null (0) link.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 17 في هذه المجموعة.
فتح الحزمة
k this deck
16
Which of the following tasks would a binary search tree not be well suited for?

A) Duplicate elimination.
B) Searching.
C) Sorting.
D) Reversing an unsorted sequence.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 17 في هذه المجموعة.
فتح الحزمة
k this deck
17
If you add the following nodes to a binary search tree in the order they appear (left-to-right): 6 34 17 19 16 10 23 3
What will be the output of a postorder traversal of the resulting tree?

A) 3 10 16 23 19 17 34 6
B) 3 6 17 16 10 19 23 34
C) 6 3 34 17 16 10 19 23
D) 10 16 23 19 17 34 3 6
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 17 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 17 في هذه المجموعة.