M
mohangupta13
hello everyone , I don't know its the write place to ask this or not.
I have a problem and I am not able to get any algorithm for it.
Given two arrays A,B of size N , each with integers from 0-(N-1) . We
have to arrange the elements in array A as they are in B (by swapping
values) with the place in A holding the digit '0' used as the temp
variable for swapping , in O(n) time and WITHOUT using any extra
variable space.
example: A[]="3021"
B[]="2130"
output: A[]="2130" using position of '0' in A as temp variable
for swap.
Also please provide any links where I can discuss algorithm related
questions if not here ( possibly any google groups?) ?
Thank you
Mohan Gupta
I have a problem and I am not able to get any algorithm for it.
Given two arrays A,B of size N , each with integers from 0-(N-1) . We
have to arrange the elements in array A as they are in B (by swapping
values) with the place in A holding the digit '0' used as the temp
variable for swapping , in O(n) time and WITHOUT using any extra
variable space.
example: A[]="3021"
B[]="2130"
output: A[]="2130" using position of '0' in A as temp variable
for swap.
Also please provide any links where I can discuss algorithm related
questions if not here ( possibly any google groups?) ?
Thank you
Mohan Gupta