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

7) Which of the following is true when you want to implement a queue with a link

ID: 3842938 • Letter: 7

Question

7) Which of the following is true when you want to implement a queue with a linked list instead of with an array?

a. As a linked list, the insert and remove functions will be O(1) while as an array, the remove is O(n)

b. Linked lists are better because the order of the content in the queue doesn’t matter while in the array, the content must be sorted for the queue to work

c. Linked lists use memory dynamically so you’ll only use space when elements are inserted into the queue. The array queue may have wasted memory space

d. None of the above

8) Which of the following is true about using a hash table?

a. If the size of your array is smaller than the total amount of expected elements, you will have to consider an algorithm for handling collisions

b. If you use linked lists to handle collisions, you likely do not need to have a second hash function to use when a collision occurs

c. The benefit of a hash table is near O(1) searching, but the price is that the data cannot be displayed in a sorted order unless you take the data in the table and convert it into a sorted array or linked list

d. None of the above

9) Which of the following is an O(n) algorithm?

a. Append an element to the end of a Linked List

b. Search for an element in a balanced Binary Tree

c. Remove from a priority queue implemented as a Linked List when insert is performing at O(1)

d. None of the above

10) Which of the following is true about the Quicksort algorithm?

a. The partition algorithm uses the last element in the current array as the pivot value

b. The high level algorithm is to partition the array and recursively quicksort the left and right sides of the pivot value if the range of the array we are currently looking at is greater than 1 element

c. The algorithm performs at near O(n) when the array is already nearly sorted

d. None of the above

Explanation / Answer

7) Which of the following is true when you want to implement a queue with a linked list instead of with an array?

a. As a linked list, the insert and remove functions will be O(1) while as an array, the remove is O(n)

b. Linked lists are better because the order of the content in the queue doesn’t matter while in the array, the content must be sorted for the queue to work

c. Linked lists use memory dynamically so you’ll only use space when elements are inserted into the queue. The array queue may have wasted memory space

d. None of the above

Which of the following is true about using a hash table?

a. If the size of your array is smaller than the total amount of expected elements, you will have to consider an algorithm for handling collisions

9) Which of the following is an O(n) algorithm?

a. Append an element to the end of a Linked List
[if we dont maintain atail pointer then append will take O(n)]

10) Which of the following is true about the Quicksort algorithm?

b. The high level algorithm is to partition the array and recursively quicksort the left and right sides of the pivot value if the range of the array we are currently looking at is greater than 1 element
[True]

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