Answer the question
In order to leave comments, you need to log in
How to convert a descending sequence to an ascending one in c++?
It is necessary to write a program in c ++:
In a dynamic array, make increasing sequences from decreasing ones.
For example, the array 5 10 8 3 2 11 9 8 7 after the program is executed should be 5 2 3 8 10 7 8 9 11
That is, the sequences 10 8 3 2 and 11 9 8 7 from were sorted in ascending order. And 5 remained in place
Answer the question
In order to leave comments, you need to log in
1) Iterate through the array, finding descending sequences.
2) Expand each of them.
3) ???
4) PROFIT!
Here's a hint for you on how you can select descending sequences in an array.
start = 0;
while (start < n) {
end = start;
ПОКА (start..end+1 - убывающая последовательность) {
++end;
}
// start..end - убывающая последовательность.
start = end+1;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question