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:
a+b+c=0
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
zero.
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
R-134a is compressed in an adiabatic compressor from saturated vapor at 100kPa to a final state at 1 MPa and 50 degrees Celcius. Before entering the compressor, the R-134a receive

show the practical use of it also descibe it elaborately why it is useful which way we can use it where we use it

how can we determine the crystal structure of material by having interplanar spacing d?

Representing vectors in different axes All positions, velocities, momentums and accelerations are really relative positions, relative velocities, relative momentums and relativ

''If a non-coplaner force system is acted upon by equal and opposite forces,it must be in equilibrium''.State this statement is true or false.Please,give me a reason.

Logic gates - and gate: Figure shows the symbol that represents 2 input AND gate together with its truth table. This gate will only adopt a 1 state at its output terminal when

Q. 1 A 50 cm diameter pipeline in the Arctic Carries hot oil at 30 0C and exposed to a coefficient surrounding temperature of -20 0C. Special powder insulation 5 cm thick surround

Actuators  The actuator consists of the control surfaces and associated servomechanisms, and is used to change the missile attitude and trajectory or flight path.

The need for working capital to run the day-to-day business activities cannot be overemphasized. We will hardly find a business firm which does not require any amount of working ca

Illustrate the importance of communication in a retail business organisation?25 marks