Help with MATLAB problem
13 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentar
Guillaume
am 11 Nov. 2016
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.
Antworten (0)
Siehe auch
Kategorien
Mehr zu Shifting and Sorting Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!