@all : if see the code closely ...logic is simple.
code is just trying many permutation to find an answer.
say input = 6
now assuming that 6 will be placed at position arr[i] and arr[j+i+1] . it
will put that value and move further to find next possible location for
input-1;
at any point of time if condition doesnt satify then we backtrack making
arr[i] and ar[ j+ i +1 ] to 0 . and find another permulation.
add
for (int k : a) {
System.out.print(k +" ");
}
inside if() condition in the given code and run this prog. you will get an
idea how it working.
On Fri, Jan 20, 2012 at 1:39 AM, RaviShankar Kushwaha <
[email protected]> wrote:
> @ Neeraj: Plz explain ur logic.
> --
> Ravi Shankar
>
> MCA 2nd Year
> Department Of Computer Science
> University Of Delhi
>
> --
> 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.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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.