Matlab, engineering, Other Engineering

The 3 sum problem: (20 pts.)
Provided a 1D array of integers, find all combinations of 3 values from this set such that:
For example, if one were provided with the set [3 1 3 -4 -6], the resulting answers would be [3 1
-4], [3 1 -4], and [3 3 -6], as these are the three sets of three values which sum to zero from the
provided set. Notice that the first and second solution appear to be the same, but correspond to two
solutions for the two different 3s in the provided set.
Your code should return the answer in 2D array format, where each row is a solution set (3
columns per row). If no solution sets can be found for a given input, the code should output a value of
For this assignment you should find or develop an algorithm for finding these solutions. Once
you have found or developed this algorithm, create a flowchart for this algorithm. Please conform to
the algorithm format outlined in class.
Your code should be adequately commented, such that one would be able to understand your
code by reading comments only. Your code should also include an initial code block giving a brief
overview of how to use the function and your solution process, so that someone can query your
program for this code block using the help command.

Develop and implement a method to identify and remove and solutions which are numerically
equivalent, so that the result from your code doesn''t have any repeated solutions. This should be able to
match solutions which contain the same values but in different orders. This means that if the sets [3 1
-4] and [3 -4 1] are in the solution your method should still identify them as equivalent and only return
one of them.
Posted Date: 2/20/2012 1:46:29 AM | Location : United States

Related Discussions:- Matlab, engineering, Assignment Help, Ask Question on Matlab, engineering, Get Answer, Expert's Help, Matlab, engineering Discussions

Write discussion on Matlab, engineering
Your posts are moderated
Related Questions
A company issues 15-year, $1,000 par-value bonds, with a coupon rate of 5%. The bonds are sold for $619.70. The tax rate is 30%. Compute the cost of debt before taxes and after tax

find IDFT of the sequence X(k)={5,0,1,-j,0,1,0,1,j,0}

Consider the binary cycle using the sodium and steam/water in the sketch below and operating at conditions in Table 1. Draw T S Diagram and find the thermal cycle efficiency

Inhibit Gate Occasionally it is required to 'hold' one input to an AND gate at a particular logic level in order to disable the entire gate. One method of representing this sy

Composites have low shear strengths compared to longitudinal strengths. The ILSS test is a simple 3 point bend test, requiring a small amount of material. A span to depth ratio

QUESTION: Modelling of phase array antenna for medical imaging. INSTRUCTION: The expert must provide a correct mathematical model solution and detail by detail steps of how it can

Noise Suppression in Aircraft Design: It has been seen that the first step towards noise suppression is at the design stage of the rotating and static parts of the engine. The

Extrusion : In this method of forging, the metal slug is forced to pass through a die under the action of intense of hydraulic pressure. The process can be viewed as squeezing the