Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Correct

94Size
Leading solution size is 87.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test
Code Input and Output
1
Pass
 
%%
tic
v=[281 87 ];
vexp=[64903 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
2
Pass
 
%%
v=[71 384 ];
vexp=[40544 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
3
Pass
 
%%
v=[280 103 ];
vexp=[14427 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
4
Pass
 
%%
v=[17357 ];
vexp=[277 162 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
5
Pass
 
%%
v=[263 381 ];
vexp=[19846 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
6
Pass
 
%%
v=[785 477 ];
vexp=[56053 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
7
Pass
 
%%
v=[19311 ];
vexp=[440 93 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
8
Pass
 
%%
v=[241 171 ];
vexp=[33049 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
9
Pass
 
%%
v=[225 94 ];
vexp=[14291 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
10
Pass
 
%%
v=[40040 ];
vexp=[185 664 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
11
Pass
 
%%
v=[565 431 ];
vexp=[60145 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
12
Pass
 
%%
v=[399 680 ];
vexp=[64178 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
13
Pass
 
%%
v=[62292 ];
vexp=[358 937 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
14
Pass
 
%%
v=[398 1051 ];
vexp=[46356 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
15
Pass
 
%%
v=[59 45 ];
vexp=[1777 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
16
Pass
 
%%
v=[47 175 ];
vexp=[3400 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
17
Pass
 
%%
v=[59987 ];
vexp=[1109 466 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
18
Pass
 
%%
v=[33547 ];
vexp=[329 129 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
19
Pass
 
%%
v=[256 45 ];
vexp=[20703 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
20
Pass
 
%%
v=[43221 ];
vexp=[1090 673 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
21
Pass
 
%%
v=[80 251 ];
vexp=[41976 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
22
Pass
 
%%
v=[40366 ];
vexp=[487 621 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
23
Pass
 
%%
v=[65 48 ];
vexp=[1289 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
24
Pass
 
%%
v=[5644 ];
vexp=[59 145 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
25
Pass
 
%%
v=[52852 ];
vexp=[307 787 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
26
Pass
 
%%
v=[61149 ];
vexp=[610 341 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
27
Pass
 
%%
v=[39087 ];
vexp=[650 141 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
28
Pass
 
%%
v=[61881 ];
vexp=[520 361 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
29
Pass
 
%%
v=[488 275 ];
vexp=[21405 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
30
Pass
 
%%
v=[33893 ];
vexp=[485 306 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
31
Pass
 
%%
v=[26965 ];
vexp=[885 547 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
32
Pass
 
%%
v=[5918 ];
vexp=[99 122 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
33
Pass
 
%%
v=[63216 ];
vexp=[90 379 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
34
Pass
 
%%
v=[248 459 ];
vexp=[60546 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
35
Pass
 
%%
v=[26250 ];
vexp=[370 607 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
36
Pass
 
%%
v=[295 476 ];
vexp=[33386 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
37
Pass
 
%%
v=[29373 ];
vexp=[450 247 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
38
Pass
 
%%
v=[183 509 ];
vexp=[64324 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
39
Pass
 
%%
v=[56818 ];
vexp=[257 433 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
40
Pass
 
%%
v=[447 730 ];
vexp=[57674 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
41
Pass
 
%%
v=[241 ];
vexp=[17 13 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
42
Pass
 
%%
v=[14807 ];
vexp=[313 86 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
43
Pass
 
%%
v=[251 145 ];
vexp=[8557 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
44
Pass
 
%%
v=[76 485 ];
vexp=[60096 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
45
Pass
 
%%
v=[24345 ];
vexp=[278 197 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
46
Pass
 
%%
v=[2581 ];
vexp=[127 79 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
47
Pass
 
%%
v=[588 247 ];
vexp=[48723 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
48
Pass
 
%%
v=[190 233 ];
vexp=[9630 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
49
Pass
 
%%
v=[367 303 ];
vexp=[61729 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
50
Pass
 
%%
v=[4019 ];
vexp=[97 40 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
51
Pass
 
%%
v=[58547 ];
vexp=[953 394 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
52
Pass
 
%%
v=[25786 ];
vexp=[367 573 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
53
Pass
 
%%
v=[52923 ];
vexp=[788 283 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
54
Pass
 
%%
v=[16812 ];
vexp=[134 319 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
55
Pass
 
%%
v=[394 323 ];
vexp=[38817 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
56
Pass
 
%%
v=[34401 ];
vexp=[352 287 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
57
Pass
 
%%
v=[27426 ];
vexp=[334 597 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
58
Pass
 
%%
v=[278 41 ];
vexp=[35775 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
59
Pass
 
%%
v=[59405 ];
vexp=[279 166 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
60
Pass
 
%%
v=[271 428 ];
vexp=[48986 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
61
Pass
 
%%
v=[539 327 ];
vexp=[59893 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
62
Pass
 
%%
v=[461 178 ];
vexp=[17867 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
63
Pass
 
%%
v=[491 627 ];
vexp=[47278 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
64
Pass
 
%%
v=[62313 ];
vexp=[712 513 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
65
Pass
 
%%
v=[10791 ];
vexp=[346 103 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
66
Pass
 
%%
v=[58888 ];
vexp=[109 419 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
67
Pass
 
%%
v=[431 114 ];
vexp=[20855 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
68
Pass
 
%%
v=[373 647 ];
vexp=[50962 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
69
Pass
 
%%
v=[60814 ];
vexp=[455 593 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
70
Pass
 
%%
v=[109 79 ];
vexp=[1321 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
71
Pass
 
%%
v=[356 581 ];
vexp=[57162 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
72
Pass
 
%%
v=[3453 ];
vexp=[98 53 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
73
Pass
 
%%
v=[2024 ];
vexp=[13 46 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
74
Pass
 
%%
v=[3453 ];
vexp=[98 53 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
75
Pass
 
%%
v=[3545 ];
vexp=[131 92 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
76
Pass
 
%%
v=[687 244 ];
vexp=[46715 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
77
Pass
 
%%
v=[26103 ];
vexp=[304 79 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
78
Pass
 
%%
v=[65174 ];
vexp=[235 326 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
79
Pass
 
%%
v=[65362 ];
vexp=[155 267 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
80
Pass
 
%%
v=[701 508 ];
vexp=[48425 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
81
Pass
 
%%
v=[272 377 ];
vexp=[31638 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
82
Pass
 
%%
v=[61570 ];
vexp=[143 265 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
83
Pass
 
%%
v=[156 251 ];
vexp=[32490 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
84
Pass
 
%%
v=[157 425 ];
vexp=[13924 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
85
Pass
 
%%
v=[726 203 ];
vexp=[39063 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
86
Pass
 
%%
v=[26 139 ];
vexp=[65376 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
87
Pass
 
%%
v=[58926 ];
vexp=[474 607 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
88
Pass
 
%%
v=[64849 ];
vexp=[397 311 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
89
Pass
 
%%
v=[38407 ];
vexp=[363 115 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
90
Pass
 
%%
v=[33546 ];
vexp=[200 329 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
91
Pass
 
%%
v=[271 201 ];
vexp=[50185 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
92
Pass
 
%%
v=[123 137 ];
vexp=[56830 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
93
Pass
 
%%
v=[41192 ];
vexp=[125 446 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
94
Pass
 
%%
v=[689 292 ];
vexp=[40211 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
95
Pass
 
%%
v=[185 51 ];
vexp=[8407 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
96
Pass
 
%%
v=[9110 ];
vexp=[189 262 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
97
Pass
 
%%
v=[128 473 ];
vexp=[34248 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
98
Pass
 
%%
v=[722 267 ];
vexp=[21147 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
99
Pass
 
%%
v=[58918 ];
vexp=[491 699 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))

                    
100
Pass
 
%%
v=[144 37 ];
vexp=[36855 ];
vout=Tree_CH(v);
assert(isequal(vout,vexp))
toc
Elapsed time is 0.522174 seconds.