Suppose that the matrix A is stored N real. Reorder items of A in such a way that the differences between neighboring data A [i] - A [i + 1]
to is an increasing sequence of numbers.
For example, if the matrix A
is
A [4] = {10, 2, 7, 4}
then possible rearrangements the table is:
{2, 7, 10, 4}, because (2-7 = 5) <(7-10 = 3) <(10-4 = 6):
{4, 10, 7, 2}, because (4-10 = 6) <(10-7 = 3) <(7-2 = 5)
the exercise is asking me to Construct C program where to place a table 15 random integers numbers which lie in the range [0,100]. in then construct a function which rearranges the numbers in ascending difference adjacent values.if someone can give me some piece of code cause i have tried everything
Aucun commentaire:
Enregistrer un commentaire