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!