-
March 1st, 2011, 12:42 AM
#1
Insert interger
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.
-
March 1st, 2011, 02:59 AM
#2
Re: Insert interger
Manually, by splitting the original array in two and copying the values to thew new array.
Wanna install linux on a vacuum cleaner. Could anyone tell me which distro sucks better?
I had a nightmare last night. I was dreaming that I’m 64-bit and my blanket is 32-bit and I couldn’t cover myself with it, so I’ve spent the whole night freezing. And in the morning I find that my blanket just had fallen off the bed. =S (from: bash.org.ru)
//always looking for job opportunities in AU/NZ/US/CA/Europe :P
willCodeForFood(Arrays.asList("Java","PHP","C++","bash","Assembler","XML","XHTML","CSS","JS","PL/SQL"));
USE [code] TAGS! Read this FAQ if you are new here. If this post was helpful, please rate it!
-
March 2nd, 2011, 05:18 PM
#3
Re: Insert interger
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|