How much is the Matlab function "sort()" calculating-efficient?

Hello, Please could someone help me knowing more about the topic below ?
- How much is the Matlab function sort() calculating-efficient? (what’s the algorithmic complexity of that function?)
Thank you in advance for your help, hoping you're having a good day.
Eric

1 件のコメント

Adam
Adam 2018 年 6 月 25 日
sort is a built-in function so unless Mathworks themselves want to divulge information on it then it is not publicly available other than for you to carry out your own tests by running it in controlled situations.
It may be that it is an umbrella function of numerous algorithms that it chooses between depending on the input, but I wouldn't know since it is hidden.

サインインしてコメントする。

 採用された回答

OCDER
OCDER 2018 年 6 月 25 日

0 投票

They said it's a quicksort with O(n log n) efficiency. You could try something like this to test it out:
X = 100:100:10000;
Y = randi(10000, 1, 10000);
SortTimes = zeros(1, length(X));
for j = 1:length(X)
SortTimes(j) = timeit(@() sort(Y(1:X(j))), 1);
end
plot(X, SortTimes)

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeShifting and Sorting Matrices についてさらに検索

質問済み:

2018 年 6 月 25 日

回答済み:

2018 年 6 月 25 日

Community Treasure Hunt

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

Start Hunting!

Translated by