Toggle Menu
Let’s consider a function that sorts an array of numbers from min to max: sort(arr).Which of the following metamorphic relations are valid?
Let’s consider a function that sorts an array of numbers from min to max: sort(arr).
Which of the following metamorphic relations are valid?
If the input array arr is reversed and passed to the sort function, the output should be the same as the original array sorted.
If an identical element is added to the array, the output should maintain the order but include the additional element in the appropriate position. (i.e., duplication is allowed / duplicated elements are not merged)
If the array is sorted and concatenated with another sorted array where all elements are larger, sorting the combined array should yield the same result as sorting the two arrays separately and concatenating them.
Back to top