Thursday, May 2, 2019

Comparison Between The Backtracking and Brute Force Approach.

S.NO

                         Backtracking

                Brute Force Approach

1)

This is an algorithm design technique for solving large instances of combinatorial problems.

This is a straightforward approach for solving a problem ,usually based on the problem’s constraints.

2)

In this method  solutions are constructed one component at a time and evaluate the partially constructed solutions as if no increasing values of the renaming components can lead to a solution , remaining components are not generated  at all and backtracks to replace the last component of the partially constructed with its next option.

In Exhaustive search, a brute force approach, all the solutions are generated and then identifies the one with a desired property.

3)

Backtracking method is efficient than Brute Force Approach.

Brute Force Approach is less efficient.

4)

When backtracking method is applied to the knapsack problem, using a dynamic state space tree formulation, leads to an efficient algorithm for every input.

Exhaustive search , a brute force approach , when applied to knapsack problem leads to an algorithm that is inefficient on every input.

5)

Backtracking method which is applied to combinatorial problems to solve the large instances of the problems ,here also we face the difficulty of exponential explosion.

An exhaustive search approach can also be applied to combinatorial problems which suggests generating each and every element of the problem’s domain ,we face the difficulty of exponential explosion.

6)

Examples of backtracking method, incudes n-queens problem ,sum of subsets problem.

Examples of brute force approach includes selection sort, sequential search.

7)

This method is not as simple as brute force approach

This approach is very easy and simple to implement

 

No comments:

Post a Comment