Select all the statements below which are TRUE. Inserting a value into a queue Q
ID: 3851657 • Letter: S
Question
Select all the statements below which are TRUE. Inserting a value into a queue Q[1..n] takes (n) in the worst-case. Counting sort is stable. Let L be a singly-linked list with n elements, sorted in increasing order. Then inserting an element x takes (n) in the worst-case. For any min-heap A[1..n], the second order statistics is always A[2]. RANDOMIZED-SELECT is using divide-and-conquer. In each step, the algorithm is recursing on two subproblems of size n/2. If f(n) = (g(n)), then f(n) = O(g(n)).Explanation / Answer
1)False because inserting a value into queue takes O(1) time
2) True bacause multiple keys with the same value are placed in the sorted array in the same order that they appear in the input array.
3)True inserting element takes O(n) in the singly linked list in the worst-case as it has to traverse all the nodes in the worst-case.
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.