Image

Imagecgs3408h4x wrote in Imagecprogramming 😯confused

Question for Sorting Arrays

Question: I have an array declared of type int containing at most, 20 elements. Moreover, I have a tracking variable, also of type int that keeps track of how many numbers are in the array. I wanted to know if anyone had any ideas as to how to write a search algorithm that takes the values, and places them in odd descending order, to even ascending.
For example, if I had the following array elements.
17 18 19 20 15 2 7 56 94 105 12 8
Then after calling the function, it should place the numbers into order like so:
105 19 17 15 7 2 8 12 18 20 56 94
Note the order and the odd or evenness of each number. If anyone has any ideas on how to implement this, I'd appreciate it. Thank you.