Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

4) Which of the following is true about stacks, queues and priority queues? a. F

ID: 3842936 • Letter: 4

Question

4) Which of the following is true about stacks, queues and priority queues?

a. For a stack, if you push 5 elements, perform pop 4 times, push 3 new elements, the very first element you pushed would still be in the stack

b. For a queue, if you insert 5 elements, perform remove 4 times, and then add 3 new elements, the very first element you added would still be in the queue

c. For a priority queue, if you insert 5 elements, perform remove 4 times, and then add 3 new elements, the very first element you added is guaranteed to still be in the queue

d. None of the above

5) Which of the following is true about the delete function of a binary search tree?

a. If the node is found to delete, the node to delete will be in 1 of 3 unique situations: one child, two children or is a leaf

b. If the node to delete has one child, the parent of the node being deleted will take that child node

c. The delete function will always perform at O(log n) no matter what condition the tree is in

d. None of the above

6) Which of the following is true about the delete function of a standard simple linked list?

a. The delete function performs at O(log n)

b. If the node to delete is the head, the new head of the list is whatever is next after head

c. If the node to delete is after the head node, you only need to use one temporary node to traverse the list, delete it and maintain the correct structure of the linked list

d. None of the above

Explanation / Answer

4) Which of the following is true about stacks, queues and priority queues?

a. For a stack, if you push 5 elements, perform pop 4 times, push 3 new elements, the very first element you pushed would still be in the stack [True because Stack follows LIFO order]

b. For a queue, if you insert 5 elements, perform remove 4 times, and then add 3 new elements, the very first element you added would still be in the queue

c. For a priority queue, if you insert 5 elements, perform remove 4 times, and then add 3 new elements, the very first element you added is guaranteed to still be in the queue

d. None of the above

5) Which of the following is true about the delete function of a binary search tree?

a. If the node is found to delete, the node to delete will be in 1 of 3 unique situations: one child, two children or is a leaf [True it falls in one of three categories]

b. If the node to delete has one child, the parent of the node being deleted will take that child node

c. The delete function will always perform at O(log n) no matter what condition the tree is in

d. None of the above

6) Which of the following is true about the delete function of a standard simple linked list?

a. The delete function performs at O(log n)

b. If the node to delete is the head, the new head of the list is whatever is next after head
[Obviously head will be the next element after orignal head]

c. If the node to delete is after the head node, you only need to use one temporary node to traverse the list, delete it and maintain the correct structure of the linked list

d. None of the above

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote