If x=[0,3,4,2,1] then y=[4,3,2,1,0]
Solution Stats
Problem Comments
14 Comments
Solution Comments
Show comments
Loading...
Problem Recent Solvers13470
Suggested Problems
-
Remove the polynomials that have positive real elements of their roots.
1741 Solvers
-
Back to basics 3 - Temp Directory
385 Solvers
-
1512 Solvers
-
Sum of first n terms of a harmonic progression
504 Solvers
-
Convert from Fahrenheit to Celsius
28103 Solvers
More from this Author1
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
it is a good problem,but I cann't solve it
Only one verification test!? and this test already has the vector sorted.
li look up the options of the sort command
Needs (much) more tests in the Test Suite!! It would also be a good idea to include a randomly generated vector in the tests; for this random input, testing of the correct function output should be hard-coded as: assert(y(1)>=y(2)); assert(y(2)>=y(3)); ... ; assert(y(end-1)>=y(end)); [It's not the most efficient check, but anything else will risk giving away clues on possible solution codes.]
i comment for the challenge
nice
comment = badge
I do not understand what is wrong with the solution?
I solved question with my algorithm
function y=desSort(x)
x=input(' give me input to obtain descending order of input')
y = zeros(size(x));
indis=0;
for j=1:length(x)
maksimum=x(j);
for i=1:length(x)
if x(i)>maksimum
maksimum=x(i);
a=i;
end
end
x(a)= 0
y(j)=maksimum
end
end
sort
tried using the sort function in a descending order would not work
good
sort with direction
good question
Good problem