calculating number of comparison in a vector
1 回表示 (過去 30 日間)
古いコメントを表示
if I have a vector with N elements and want to find the maximum M elements from them, how many comparison operations I need??
4 件のコメント
回答 (1 件)
Dimitris Kalogiros
2018 年 9 月 3 日
It depends on the algorithm than you will use.
You can use a bubble sort routine to sort the vector and then to choose M most max elements (or min elements).
参考
カテゴリ
Help Center および File Exchange で Shifting and Sorting Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!