Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Problem 1844. Create a v-notch vector without "sort" function

Created by Swapnali Gujar

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

Problem Group

Solution Statistics

25 correct solutions 17 incorrect solutions
Last solution submitted on Mar 10, 2014