Advanced Engineering Mathematics
Advanced Engineering Mathematics
10th Edition
ISBN: 9780470458365
Author: Erwin Kreyszig
Publisher: Wiley, John & Sons, Incorporated
Bartleby Related Questions Icon

Related questions

Question

make maqthlab code 

(Selection Sort) There are many, many algorithms for sorting a list of data. In the
Sclection Sort algorithm, the data is logically (although not usually physically) bro-
ken into two disjoint subpicces. Those pieces are a sorted subpicce and an unsorted
subpiece. Initially, the sorted subpicce is empty and the unsorted subpicce is therefore
the entire list. The algorithm then proceeds in iterations and, in cach iteration, the
minimum element from the unsorted piece is located and swapped into the position
where the unsorted list starts (thereby placing it in the appropriate location). The
description and animation on the Wikipedia page for Selection Sort might be VERY
helpful here.
The code for this should consist of an outer loop and an inner loop. Your input will be
an arbitrary-length (row) vector, and you will produce a matrix where the first row is
the initial vector and cach subsequent row is the result of one pass of the outer loop.
See below for sample runs.
select_sort Function:
Input variables:
• a vector of unsorted data
Output variables:
a matrix of the results after cach pass of the outer loop
A possible sample case is:
» data = select_sort([1 2 4 5 3])
data
1
4 5
3
1
4
3
1
2
4
3
4
1
2
4
5
expand button
Transcribed Image Text:(Selection Sort) There are many, many algorithms for sorting a list of data. In the Sclection Sort algorithm, the data is logically (although not usually physically) bro- ken into two disjoint subpicces. Those pieces are a sorted subpicce and an unsorted subpiece. Initially, the sorted subpicce is empty and the unsorted subpicce is therefore the entire list. The algorithm then proceeds in iterations and, in cach iteration, the minimum element from the unsorted piece is located and swapped into the position where the unsorted list starts (thereby placing it in the appropriate location). The description and animation on the Wikipedia page for Selection Sort might be VERY helpful here. The code for this should consist of an outer loop and an inner loop. Your input will be an arbitrary-length (row) vector, and you will produce a matrix where the first row is the initial vector and cach subsequent row is the result of one pass of the outer loop. See below for sample runs. select_sort Function: Input variables: • a vector of unsorted data Output variables: a matrix of the results after cach pass of the outer loop A possible sample case is: » data = select_sort([1 2 4 5 3]) data 1 4 5 3 1 4 3 1 2 4 3 4 1 2 4 5
Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Recommended textbooks for you
Text book image
Advanced Engineering Mathematics
Advanced Math
ISBN:9780470458365
Author:Erwin Kreyszig
Publisher:Wiley, John & Sons, Incorporated
Text book image
Numerical Methods for Engineers
Advanced Math
ISBN:9780073397924
Author:Steven C. Chapra Dr., Raymond P. Canale
Publisher:McGraw-Hill Education
Text book image
Introductory Mathematics for Engineering Applicat...
Advanced Math
ISBN:9781118141809
Author:Nathan Klingbeil
Publisher:WILEY
Text book image
Mathematics For Machine Technology
Advanced Math
ISBN:9781337798310
Author:Peterson, John.
Publisher:Cengage Learning,
Text book image
Basic Technical Mathematics
Advanced Math
ISBN:9780134437705
Author:Washington
Publisher:PEARSON
Text book image
Topology
Advanced Math
ISBN:9780134689517
Author:Munkres, James R.
Publisher:Pearson,