Please read carefully first before answering. Thank you!
Given a list of X objects, you want to create a program that
performs the following operations.
● func1 Get the first (F) and last (L) object and place them
both at the start of the list.
- e.g. ABCDE becomes
AEBCD
*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 Single Linked List?
2. if you were to implement the solution using
an Array?
3. What is the best Linear data structure for
implementing this program (choose one from the 2 mentioned above).
Justify your answer.
Assume that the time complexity of func1 is O(M):
4. What is the time complexity of the program
if we repeatedly call func1 consecutively until we find the
original order of the list of X objects? Justify your answer
5. 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 func1 provided? Justify
your answer.
Please read carefully first before answering. Thank you! Given a list of X objects, you want to create a program that pe
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
Please read carefully first before answering. Thank you! Given a list of X objects, you want to create a program that pe
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!