How about using 1 variable o(1) Space..
i.e Scan the array and compare the element... at a[1]=a1, a[2]=b1,
a[3]=a2,......
first check(a[i]), say b2 in array of size 8, so Its clear b2 must be
placed at 8/2+2 position in an array..
so Space=a[8/2+2]
a[8/2+2]=b2, the actual place of b2
now a[6] is stored into space, which is b3, since in every even
position B is stored initially we can use this property..
so now a[6] i.e. space which contains b3 should be stored in a[7]..
pls try further... ;-)
or try making a seires... given array of 10 such values..
intially, a1 is at positin
b1 should go to 6 posi
b3 goes t 8 posi
b4 goes to 9 posi
a5 goes to 5 posi..
......................x posi
so can we form a series 6-8-9-5-..... depending upon the size of
array???????????????????/
I think Enough for now ;(
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups-beta.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---