An array is provided. For example, a= [ 2,1,11,4,5,13]
Create an array from a like this way, out= [ 1,11,2,13,4,5]
➢ 1st take the smallest element from a and put it in output array.
➢ 2nd take the largest element from a and put it in output array.
➢ Then take the 2nd smallest element from a and put it in output array.
➢ Then take the 2nd largest element from a and put it in output array.
And so on.
The length of the array can be 100 or 1000. Your code should perform correctly for all cases
Solution Stats
Solution Comments
Show comments
Loading...
Problem Recent Solvers36
Suggested Problems
-
Create a cell array out of a struct
2603 Solvers
-
Area of an equilateral triangle
7020 Solvers
-
Find out total non zero element of matrix
288 Solvers
-
Deleting an element in a matrix
499 Solvers
-
6645 Solvers
More from this Author30
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!