Given a list of X objects, you want to create a program that performs the following operations: • funcl Get the first (F) and last (L) object and place them both at the start of the list. e.g. ABCDE...



answer the following questions: *refer to the photo below*



Given a list of X objects, you want to create a<br>program that performs the following operations:<br>• funcl Get the first (F) and last (L) object and<br>place them both at the start of the list.<br>e.g. ABCDE becomes AEBCD<br>• func2 Get the first (F) and last (L) object and<br>place them both at the end of the list.<br>e.g. ABCDE becomes BCDAE<br>Assume that the size of the list will never change<br>once initialized.<br>

Extracted text: Given a list of X objects, you want to create a program that performs the following operations: • funcl Get the first (F) and last (L) object and place them both at the start of the list. e.g. ABCDE becomes AEBCD • 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.
Assume that the time complexity of funcl and func2 is O(M) and O(N), respectively.<br>What is the time complexity of the program if:<br>7. we repeatedly call funcl and func2 consecutively until we find the original order<br>of the list of X objects? Justify your answer.<br>8. we repeatedly call func2 until we find the original order of the list of X objects?<br>Justify your answer.<br>9. we provide a list of X numbers in descending order and we want to sort it in<br>ascending order using the two functions provided? Justify your answer.<br>

Extracted text: Assume that the time complexity of funcl and func2 is O(M) and O(N), respectively. What is the time complexity of the program if: 7. we repeatedly call funcl and func2 consecutively until we find the original order of the list of X objects? Justify your answer. 8. we repeatedly call func2 until we find the original order of the list of X objects? Justify your answer. 9. we provide a list of X numbers in descending order and we want to sort it in ascending order using the two functions provided? Justify your answer.

Jun 08, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here