what is BACKTRACK

Let's talk about algorithms!

Moderator: Board moderators

Post Reply
alamit
New poster
Posts: 10
Joined: Mon Jun 05, 2006 12:21 pm

what is BACKTRACK

Post by alamit »

who can tell me what is BACKTRACK?
asif_rahman0
Experienced poster
Posts: 209
Joined: Sun Jan 16, 2005 6:22 pm

Post by asif_rahman0 »

The main thing of Backtrack is find all possible way.
Backtrack is nothing just searching for a destination.
Because sometimes its hard to find a destination in normal brute force method for special case.
Suppose.
we have to find value 10 from A[]={9,1,5,2,11,3,4} like the following sequence that we can generate all possible sum of elements from A[].
so our output will be the same as :-
{9,1}=10
{1,5,4}=10
{5,2,3}=10 ...not {2,3,5} it will be wrong..got it alamit!!!:)
{1,2,3,4}=10

Now you have to generate a recursive code like DFS. dont u know DFS??
such as : --recur(index,sum,value)
N.B. : sometimes its not the best selection for problems. Coz Time Limit.
hope u got it.:)
alamit
New poster
Posts: 10
Joined: Mon Jun 05, 2006 12:21 pm

Post by alamit »

thanks
:o :o :o :o :o
Post Reply

Return to “Algorithms”