Define a function
gwith two arguments,wandn, wherewa list of integers sorted in descending order andsnis an integer.;gshould return a list produced by insertingnintowin a way that maintains descending order.
For example g[{9, 8, 5, 3, 2, 1}, 6] must return {9, 8, 6, 5, 3, 2, 1}.
How cam I do this in the best way in functional programming?
g[l_List, n_Integer] := Sort[Flatten[{l, n}], Greater]– corey979 Nov 26 '16 at 21:48