Cody

Problem 1456. Beads on a Necklace (Convex Hulls)

Solution 1599064

Submitted on 3 Aug 2018
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
xy = [1 1;1 2;2 2;2 1]; tf_correct = true; assert(isequal(allConvex(xy),tf_correct))

d_prev = 0 0 -1 d = 0 0 -1 d = 0 0 -1 d = 0 0 -1

2   Pass
xy = [1 1;3 1;2 2;2 3]; tf_correct = false; assert(isequal(allConvex(xy),tf_correct))

d_prev = 0 0 2 d = 0 0 -1 d = 0 0 1 d = 0 0 4

3   Pass
xy = [6 4;10 6;10 3;3 1;5 5]; tf_correct = false; assert(isequal(allConvex(xy),tf_correct))

d_prev = 0 0 -12 d = 0 0 -21 d = 0 0 -24 d = 0 0 -6 d = 0 0 6

4   Fail
xy = [8 4;3 7;4 10;9 10;9 6;5 4]; tf_correct = true; assert(isequal(allConvex(xy),tf_correct))

d_prev = 0 0 -18 d = 0 0 -15 d = 0 0 -20 d = 0 0 -16 d = 0 0 6 d = 0 0 9

Assertion failed.

5   Pass
xy = [14 26;14 29;2 15;2 7;3 7;18 17;8 23;26 11]; tf_correct = false; assert(isequal(allConvex(xy),tf_correct))

d_prev = 0 0 36 d = 0 0 96 d = 0 0 8 d = 0 0 10 d = 0 0 190 d = 0 0 12 d = 0 0 126 d = 0 0 -36

6   Fail
xy = [18 11;9 8;4 10;12 30;25 17;30 23;26 26;3 6]; tf_correct = true; assert(isequal(allConvex(xy),tf_correct))

d_prev = 0 0 -33 d = 0 0 -116 d = 0 0 -364 d = 0 0 143 d = 0 0 39 d = 0 0 149 d = 0 0 185 d = 0 0 0

Assertion failed.

7   Fail
xy = [1 1;1 2;1 3;3 3;3 1]; tf_correct = true; assert(isequal(allConvex(xy),tf_correct))

d_prev = 0 0 0 d = 0 0 -2 d = 0 0 -4 d = 0 0 -4 d = 0 0 -2

Assertion failed.

Suggested Problems

More from this Author50

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!