Question: Prove that BadSort ( below ) is not a correct sorting algorithm. Input: data: array of integers Input: n : size of data Output: Permutation
Prove that BadSort below is not a correct sorting algorithm.
Input: data: array of integers
Input: : size of data
Output: Permutation of data such that
datadatadotsdata
Algorithm: BadSort
for to step do
Consider every value of data, starting at data ;
if two of these values are out of order then
Swap them;
end
end
return data;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
