Cody

Solution 199747

Submitted on 2 Feb 2013 by Richard Zapor
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

This solution is outdated. To rescore this solution, log in.

Test Suite

Test Status Code Input and Output
1   Pass
%% x = rand(100000, 1); 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.0487 t_myunique = 1.6000e-05
2   Pass
%% x = rand(10000, 1); 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.0012 t_my_unique = 9.0000e-06
3   Pass
%% x = [1:100000 2 3 4]; 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.0060 t_my_unique = 1.3000e-05