3. Here is the pseudocode for Selection Sort: for i = 0 to n-2 inclusive: minindex = i for j = i+1 to n-1 inclusive: if A[j] < A[minindex]: minindex = j end if end for swap (A[i], A [minindex]) end for Suppose our array A is subject to some caching issues whereby closer entries take less time to swap. Specifically swap (A[x], A[y]) takes time d if |x − y| ≤ 3 and time 2d if |x − y| > 3. In addition suppose the entire conditional takes time c and nothing else takes any time at all. (a) What is the shortest list length for which the caching issue could possibly matter? Valid [5 pts] answers are integers or NONE. Smallest List Length? (b) What is the longest list length for which the caching issue could possibly not matter? Valid answers are integers or NONE. Longest List Length? [5 pts] (c) For each of the following list lengths how long will it take the code to run in the best and [10 pts] in the worst cases? Simplify your answers. List Length n = 3 n = 6 Best Time Worst Time
3. Here is the pseudocode for Selection Sort: for i = 0 to n-2 inclusive: minindex = i for j = i+1 to n-1 inclusive: if A[j] < A[minindex]: minindex = j end if end for swap (A[i], A [minindex]) end for Suppose our array A is subject to some caching issues whereby closer entries take less time to swap. Specifically swap (A[x], A[y]) takes time d if |x − y| ≤ 3 and time 2d if |x − y| > 3. In addition suppose the entire conditional takes time c and nothing else takes any time at all. (a) What is the shortest list length for which the caching issue could possibly matter? Valid [5 pts] answers are integers or NONE. Smallest List Length? (b) What is the longest list length for which the caching issue could possibly not matter? Valid answers are integers or NONE. Longest List Length? [5 pts] (c) For each of the following list lengths how long will it take the code to run in the best and [10 pts] in the worst cases? Simplify your answers. List Length n = 3 n = 6 Best Time Worst Time
Related questions
Question
Part C only please, as quickly as possible. DO NOT USE AI, IT DOESNT WORK
![3. Here is the pseudocode for Selection Sort:
for i = 0 to n-2 inclusive:
minindex = i
for j = i+1 to n-1 inclusive:
if A[j] < A[minindex]:
minindex = j
end if
end for
swap (A[i], A [minindex])
end for
Suppose our array A is subject to some caching issues whereby closer entries take less time to
swap. Specifically swap (A[x], A[y]) takes time d if |x − y| ≤ 3 and time 2d if |x − y| > 3.
In addition suppose the entire conditional takes time c and nothing else takes any time at all.
(a) What is the shortest list length for which the caching issue could possibly matter? Valid [5 pts]
answers are integers or NONE.
Smallest List Length?
(b) What is the longest list length for which the caching issue could possibly not matter?
Valid answers are integers or NONE.
Longest List Length?
[5 pts]
(c) For each of the following list lengths how long will it take the code to run in the best and [10 pts]
in the worst cases? Simplify your answers.
List Length
n = 3
n = 6
Best Time Worst Time](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fe0394dda-1230-46f2-92ff-9edb879436e7%2Fc86f2f5c-fc82-42c8-b6fb-86c5f4a2b1e7%2Fregxw3l_processed.png&w=3840&q=75)
Transcribed Image Text:3. Here is the pseudocode for Selection Sort:
for i = 0 to n-2 inclusive:
minindex = i
for j = i+1 to n-1 inclusive:
if A[j] < A[minindex]:
minindex = j
end if
end for
swap (A[i], A [minindex])
end for
Suppose our array A is subject to some caching issues whereby closer entries take less time to
swap. Specifically swap (A[x], A[y]) takes time d if |x − y| ≤ 3 and time 2d if |x − y| > 3.
In addition suppose the entire conditional takes time c and nothing else takes any time at all.
(a) What is the shortest list length for which the caching issue could possibly matter? Valid [5 pts]
answers are integers or NONE.
Smallest List Length?
(b) What is the longest list length for which the caching issue could possibly not matter?
Valid answers are integers or NONE.
Longest List Length?
[5 pts]
(c) For each of the following list lengths how long will it take the code to run in the best and [10 pts]
in the worst cases? Simplify your answers.
List Length
n = 3
n = 6
Best Time Worst Time
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps
