Can we solve this problem without using sort?
이전 댓글 표시
. A vector is given by x = [9 –1.5 13.4 13.3 –2.1 4.6 1.1 5 –6.1 10 0.2].
Using conditional statements and loops, write a program that rearranges
the elements of x in order from the smallest to the largest. Do not use MATLAB’s
built-in function sort
답변 (2개)
Cris LaPierre
2020년 5월 9일
편집: Cris LaPierre
2020년 5월 9일
1 개 추천
To answer your qeustion, yes, you can. This is a classic problem in introductory programming classes.
James Tursa
2020년 5월 9일
0 개 추천
Introductory programming classes usually start with the bubble sort. See here for the algorithm in pseudo-code:
카테고리
도움말 센터 및 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!