Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
x = rand(10000, 1);
z = rand(10000, 1);
x = vertcat(x, z);
tic
y_correct = unique(x);
t_unique = toc
tic
y_myunique = my_unique(x);
t_myunique = toc
assert(isequal(sort(my_unique(x)),y_correct) && t_unique > t_myunique)
t_unique =
0.0072
t_myunique =
5.8000e-05
|
2 | Pass |
x = rand(50000, 1);
z = rand(50000, 1);
x = vertcat(x, z);
tic
y_correct = unique(x);
t_unique = toc
tic
y_my_unique = my_unique(x);
t_my_unique = toc
assert(isequal(sort(my_unique(x)),y_correct) && t_unique > t_my_unique)
t_unique =
0.0115
t_my_unique =
3.7000e-05
|
3 | Pass |
x = [1; 2; 3; 4; 2; 3; 4; 5;];
tic
y_correct = unique(x);
t_unique = toc
tic
y_my_unique = my_unique(x);
t_my_unique = toc
assert(isequal(sort(my_unique(x)),y_correct) && t_unique > t_my_unique)
t_unique =
3.5700e-04
t_my_unique =
2.2100e-04
|
Back to basics 16 - byte order
172 Solvers
251 Solvers
Generate N equally spaced intervals between -L and L
565 Solvers
3072 Solvers
669 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!