Page 1 of 1

Please read carefully first before answering. Thank you! Note: this has a different given and question from the others.

Posted: Fri Apr 29, 2022 7:11 am
by answerhappygod
Please read carefully first before answering. Thank you!
Note: this has a different given and question from the
others.
Given a list of X objects, you want to create a program that
performs the following operations.
● func2 Get the first (F) and last (L) object and place them
both at the end of the list.
- e.g. ABCDE becomes
BCDAE
*Assume that the size of the list will never change once
initialized.
*Give both the equation AND the Big-O notation when time
complexity is asked for.
Find the worst-case time complexity for the following
cases:
1. if you were to implement the solution
using a Stack?
2. if you were to implement the solution
using a Doubly Linked List?
3. if you were to implement the solution
using a Dequeue?
4. What is the best Linear data structure
for implementing this program (choose one from the 3 mentioned
above). Justify your answer
Assume that the time complexity of func2 is O(N)
5. What is the time complexity of the
program if we repeatedly call func2 consecutively until we
find the original order of the list of X objects? Justify your
answer.
6. What is the time complexity of the
program if we provide a list of X numbers in descending order and
we want to sort it in ascending order using the
func2 provided? Justify your answer.