Given a vector vec, create a v-shaped vector as shown below: vec = [ 10 2 3 89 5 7 90 0 12]
Output vector = [90 89 12 10 7 5 3 2 0 0 2 3 5 7 10 12 89 90]
Here, all the elements of input vector are repeated in output vector, however first half part of the output vector is in descending order and rest is in ascending order. Once such output vector is plotted, it will show a v-shape on the graph.
Do not use builtin sort function
Solution Stats
Problem Comments
2 Comments
Solution Comments
Show comments
Loading...
Problem Recent Solvers36
Suggested Problems
-
Getting the absolute index from a matrix
259 Solvers
-
find the maximum element of the matrix
546 Solvers
-
Find the index of the largest value in any vector X=[4,3,4,5,9,12,0,4.....5]
405 Solvers
-
294 Solvers
-
396 Solvers
More from this Author25
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
The first test reads the file your_fcn_name.m, but the function template uses a different name. Is this a hacking problem?
Seems like it might have been overlooked while making a change to the problem recently (most likely banning the sort and/or related functions). It has been fixed now.