Question: 1 . Create a user - defined function. There will not be any output arguments. There will be two input arguments filename and n (
Create a user
defined function. There will not be any output arguments. There will
be two input arguments filename and n
a number
a
All the code will be within the user
defined function. Make sure that the
name of your m
file matches the name of your function.
Create an empty array and assign it to a variable.
Create a for loop that uses the input argument n as the last value in the vector
expression.
a
The for loop should perform n iterations.
Within the for loop, populate the array from step
using user input.
a
Prompt the user to enter a number and assign the number to the next index
after the current final element.
b
Once the for loop ends the array created in step
should now have n
elements.
Use the pseudocode below to sort the array from step
Indentation is used to show
where statements end.
Given an array arrn
for i to n
assignminldx the value i
for ji to n
if the element of arr at index j is less than the element at index minldx reassign minldx the value j
if minldx is not equal to i
swap the element at index i and the element at index minldx
write the sorted array to the file opened in step
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
