@Neeraj
Thanx for providing the algo

On Thu, Jan 19, 2012 at 7:18 PM, rahul patil
<rahul.deshmukhpa...@gmail.com>wrote:

> Looks like classic example of backtrack !!!
>
>
> On Thu, Jan 19, 2012 at 1:05 PM, Prakash D <cegprak...@gmail.com> wrote:
>
>> ignore my last comment.. misunderstood
>>
>>
>> On Thu, Jan 19, 2012 at 1:04 PM, Prakash D <cegprak...@gmail.com> wrote:
>>
>>> why can't u simply place it as 1 2 3 4 5 6 7 1 2 3 4 5 6 7?
>>>
>>>
>>> On Thu, Jan 19, 2012 at 2:05 AM, NEERAJ KODDHAN 
>>> <neerajdc...@gmail.com>wrote:
>>>
>>>> int[] a = new int[2*n];
>>>> put(a, n);
>>>>
>>>> static void put(int[] a,int i){
>>>>  if(i>0){
>>>>  for(int j=0;j<a.length-i-1;j++){
>>>> if(a[j]==0 && a[j+i+1]==0){
>>>>  a[j]=i;
>>>> a[j+i+1]=i;
>>>> put(a, i-1);
>>>>  a[j]=0;
>>>> a[j+i+1]=0;
>>>> }
>>>>  }
>>>> }else if(i==0){
>>>> for (int k : a) {
>>>>  System.out.print(k +" ");
>>>> }
>>>> System.out.println();
>>>>  }
>>>> }
>>>>
>>>>
>>>> On Wed, Jan 18, 2012 at 10:04 PM, Coding Geek 
>>>> <codinggee...@gmail.com>wrote:
>>>>
>>>>> Place N number from 1 to N, in 2N positions in such a way so that
>>>>> there are
>>>>>
>>>>> Exactly ā€œnā€ number of cells between two placed locations of number
>>>>> ā€œnā€.
>>>>> Write a program to display numbers placed in this way.
>>>>>
>>>>> Example:-
>>>>>
>>>>> (1) One of the possible placement for 7 numbers in 14 positions is :
>>>>> 5 7 2 3 6 2 5 3 4 7 1 6 1 4
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>>
>>>>> "To Iterate is Human, To Recurse is Divine"
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Algorithm Geeks" group.
>>>>> To post to this group, send email to algogeeks@googlegroups.com.
>>>>> To unsubscribe from this group, send email to
>>>>> algogeeks+unsubscr...@googlegroups.com.
>>>>> For more options, visit this group at
>>>>> http://groups.google.com/group/algogeeks?hl=en.
>>>>>
>>>>
>>>>  --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Algorithm Geeks" group.
>>>> To post to this group, send email to algogeeks@googlegroups.com.
>>>> To unsubscribe from this group, send email to
>>>> algogeeks+unsubscr...@googlegroups.com.
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/algogeeks?hl=en.
>>>>
>>>
>>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Regards,
> Rahul Patil
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to