Can anybody help me..
how to insert 8 integer let say 1,2,3,4,5,6,7,8. then swap that would be 5,6,7,8,1,2,3,4. what the suitable algorithm?
i need very urgently..
Pls help..
Thanks.
Printable View
Can anybody help me..
how to insert 8 integer let say 1,2,3,4,5,6,7,8. then swap that would be 5,6,7,8,1,2,3,4. what the suitable algorithm?
i need very urgently..
Pls help..
Thanks.
Manually, by splitting the original array in two and copying the values to thew new array.
break the array in two parts
lets assume ur array is MY_ARRAY
transfer the MY_ARRAY's 1234 elements in array AR /*AR is our second array*/
and then transfer the 5678 elements in array AR2 /*AR2 is our third array*/
you can use condition statements for this
then transfer the AR2 elements in MY_ARRAY again with the help of loop...loop will start from 0 and go to 3.....now this time ur MY_ARRAY indexing be MY_ARRAY[0]=5......................MY_ARRAY[3]=8...
and after that transfer the AR's elements in ARRAY with the help of a loop....but remember this time u choose a loop which run from 4....otherwise elements may overwrited....then array indexing will be
MY_ARRAY[4]=1................MY_ARRAY[7]=4....
print the values of MY_ARRAY
output is like
56781234
thats all