Help with MATLAB problem

13 ビュー (過去 30 日間)
john doe
john doe 2016 年 11 月 11 日
編集済み: per isakson 2016 年 11 月 11 日
The problem is listed below. If anyone could provide me some guidance, I would greatly appreciate it, I kind of don't know where to start!
*"Create a new script file called LASTNAME_LAB6_problem4.m. Again, begin by printing both your name and a title at the beginning of code using the DISP command.
A vector is given by
x=[4.5 5 -16.12 21.8 10.1 -16.11 5 14 -3 3 2]
Using conditional statements and loops, write a program that implements “Selection Sort” to rearrange the elements of x in order from the smallest to the largest. Do NOT use MATLAB’s built-in function sort().
Selection Sort Suppose x is an array of n values. We want to sort x in ascending order. That is, x[1] should be the smallest and x[n] should be the largest. The idea of Selection Sort is that we repeatedly find the smallest element in the unsorted part of the array and swap it with the first element in the unsorted part of the array. "*
  1 件のコメント
Guillaume
Guillaume 2016 年 11 月 11 日
By help you mean "do it for me because I can't be bothered and I'd rather cheat on my assignment"?
Otherwise, you would be asking a specific question about the attempt that you made.

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeShifting and Sorting Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by