Cody

Solution 886480

Submitted on 5 May 2016 by tr4nshum4n
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
a = [1 2 3 4]; t = 0; b_correct = [4 3 2 1]; assert(isequal(targetSort(a,t),b_correct))

shell = 1 b = 1 shell = 2 b = 2 1 shell = 3 b = 3 2 1 shell = 4 b = 4 3 2 1

2   Pass
a = -4:10; t = 3.6; b_correct = [-4 -3 10 -2 9 -1 8 0 7 1 6 2 5 3 4]; assert(isequal(targetSort(a,t),b_correct))

shell = 7.6000 b = -4 shell = 6.6000 k = 2 b = -4 -3 shell = 5.6000 k = 2 k = 3 b = -4 -3 -2 shell = 4.6000 k = 2 k = 3 k = 4 b = -4 -3 -2 -1 shell = 3.6000 k = 2 k = 3 k = 4 k = 5 b = -4 -3 -2 -1 0 shell = 2.6000 k = 2 k = 3 k = 4 k = 5 k = 6 b = -4 -3 -2 -1 0 1 shell = 1.6000 k = 2 k = 3 k = 4 k = 5 k = 6 k = 7 b = -4 -3 -2 -1 0 1 2 shell = 0.6000 k = 2 k = 3 k = 4 k = 5 k = 6 k = 7 k = 8 b = -4 -3 -2 -1 0 1 2 3 shell = 0.4000 k = 2 k = 3 k = 4 k = 5 k = 6 k = 7 k = 8 k = 9 b = -4 -3 -2 -1 0 1 2 3 4 shell = 1.4000 k = 2 k = 3 k = 4 k = 5 k = 6 k = 7 k = 8 b = -4 -3 -2 -1 0 1 2 5 3 4 shell = 2.4000 k = 2 k = 3 k = 4 k = 5 k = 6 k = 7 b = -4 -3 -2 -1 0 1 6 2 5 3 4 shell = 3.4000 k = 2 k = 3 k = 4 k = 5 k = 6 b = -4 -3 -2 -1 0 7 1 6 2 5 3 4 shell = 4.4000 k = 2 k = 3 k = 4 k = 5 b = -4 -3 -2 -1 8 0 7 1 6 2 5 3 4 shell = 5.4000 k = 2 k = 3 k = 4 b = -4 -3 -2 9 -1 8 0 7 1 6 2 5 3 4 shell = 6.4000 k = 2 k = 3 b = -4 -3 10 -2 9 -1 8 0 7 1 6 2 5 3 4

3   Pass
a = 12; t = pi; b_correct = 12; assert(isequal(targetSort(a,t),b_correct))

shell = 8.8584 b = 12

4   Pass
a = -100:-95; t = 100; b_correct = [-100 -99 -98 -97 -96 -95]; assert(isequal(targetSort(a,t),b_correct))

shell = 200 b = -100 shell = 199 k = 2 b = -100 -99 shell = 198 k = 2 k = 3 b = -100 -99 -98 shell = 197 k = 2 k = 3 k = 4 b = -100 -99 -98 -97 shell = 196 k = 2 k = 3 k = 4 k = 5 b = -100 -99 -98 -97 -96 shell = 195 k = 2 k = 3 k = 4 k = 5 k = 6 b = -100 -99 -98 -97 -96 -95

More from this Author95