Cody

Problem 1478. Hamiltonian Cycle

Solution 1798749

Submitted on 27 Apr 2019
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   Fail
A=[0 1 0 0 ; 0 0 1 0 ; 0 0 0 1 ; 1 0 0 0]; T=[1 2 3 4]; y_correct = true; assert(isequal(isHamiltoniaCycle(A,T),y_correct)) A=[0 1 0 0 ; 0 0 1 0 ; 0 0 0 1 ; 0 1 0 0]; T=[1 2 3 4]; y_correct = false; assert(isequal(isHamiltoniaCycle(A,T),y_correct))

z = [] z = 0 0 0 4 y = logical 0

Assertion failed.

2   Fail
A=[0 1 0 1 ; 1 1 1 0 ; 0 1 1 0 ; 0 0 1 0]; T=[1 2 3 4]; y_correct = false; assert(isequal(isHamiltoniaCycle(A,T),y_correct))

z = [] z = 0 2

Matrix dimensions must agree. Error in isHamiltoniaCycle (line 6) if z==T Error in Test2 (line 4) assert(isequal(isHamiltoniaCycle(A,T),y_correct))

3   Fail
A=[0 1 0 1 ; 1 1 1 0 ; 0 1 1 0 ; 0 0 1 0]; T=[3 2 1 4 ]; y_correct = true; assert(isequal(isHamiltoniaCycle(A,T),y_correct))

z = [] z = 0 2

Matrix dimensions must agree. Error in isHamiltoniaCycle (line 6) if z==T Error in Test3 (line 4) assert(isequal(isHamiltoniaCycle(A,T),y_correct))

4   Fail
A=[0 1 0 1 ; 1 1 1 0 ; 0 1 1 0 ; 0 0 1 0]; T=[2 3 2 3 ]; y_correct = false; assert(isequal(isHamiltoniaCycle(A,T),y_correct))

z = [] z = 0 2

Matrix dimensions must agree. Error in isHamiltoniaCycle (line 6) if z==T Error in Test4 (line 4) assert(isequal(isHamiltoniaCycle(A,T),y_correct))