Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Back Tracking 1 Back Tracking [ 3 0 marks ] Problem: Given is a set of n integers, a 1 , a 2 , dots,

Back Tracking 1 Back Tracking [30 marks]
Problem: Given is a set of n integers, a1,a2,dots,an, split the set into two subsets A and B, if
possible, such that |i=1nAAaiinA|=|i=1nAAbiinB| and AB=.
You are required to:
Implement a brute force Backtracking algorithm to find that.
Implement an algorithm that uses Backtracking with Heuristics to implement the above
problem.
Provide the time difference in finding the solution for the problem with the above approaches.
Implement your algorithm in C++ or Java. Here is specification for the input an output of your
program.
Input: Standard input. First line provides total number of elements in the set. Then the next n
lines give the elements of that set.
Sample input:
5
1
2
3
4
5
Output:
5+1=4+2
5+2=4+3
(etc)
Problem: Given is a set of n integers, a1,a2,...,an,, split the set into two subsets A and B, if possible, such that |\Sigma ni=1ai in A |=|\Sigma ni=1bi in B |andA\cap B=\phi .
You are required to:
1. Implement a brute force Backtracking algorithm to find that.
2. Implement an algorithm that uses Backtracking with Heuristics to implement the above problem.
3. Provide the time difference in finding the solution for the problem with the above approaches.
Implement your algorithm in C++ or Java. Here is specification for the input an output of your program.
Input: Standard input. First line provides total number of elements in the set. Then the next n lines give the elements of that set.
Sample input:
512345
Output:
5+1=4+2
5+2=4+3
(etc)
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Instant Reference

Authors: Gruber, Martin Gruber

2nd Edition

0782125395, 9780782125399

More Books

Students also viewed these Databases questions