Biig D
2011-02-19 15:38:19 UTC
Write a program that will shift the values of an array one position to the left. For example, suppose we have an array of integers called Matrix that stores the sequence of values (15, 4, 8, 9, 7, 11, 12) and we want to rotate the values so that the value at the front of the list goes to the back and the order of the other values stays the same. In other words, we want to move the 15 to the back, yielding the list (4, 8, 9, 7, 11, 12, 15).
Before shifting int [] Matrix={15, 4, 8, 9, 7, 11, 12};
After shifting int [] Matrix={4, 8, 9, 7, 11, 12, 15};
And
Write a program that will first create Array1 and initialized with the following elements
(20, 30, 40, 50, 60), Array2 with the following elements (11, 12, 13, 14, 15). The program will copy the elements of Array1 into Array2 and print the final values of Array2.
Before: int [] Array1={20, 30, 40, 50, 60};
int [] Array 2={11, 12, 13, 14, 15};
After: int [] Array1={20, 30, 40, 50, 60};
int [] Array2={20, 30, 40, 50, 60};
Can anyone give me a detailed explanation on how this is to be done?