SelectSmart.com®
Before you decide
Over 20,000 selectors
 kspiller's flowchart create and edit page
 Privacy info.
▷ ▶ Three Sum SelectSmart.com free Computer flowcharts and decision trees.
 A SelectSmart.com Flowchart by kspiller. See kspiller's 4me blog page. Viewed 140 times. Created December 2013. This SelectSmart.com Computer flowchart, a free online decision tool is a creation of kspiller and for amusement purposes only. The implicit and explicit opinions expressed here are the author's. SelectSmart.com does not necessarily agree.
Three Sum
By kspiller
Search for more flowcharts          Make a flowchart
 RATE THISFLOWCHART

 Provided a 1D array of integers, find all combinations of 3 values from this set such that a+b+c=0 Does the combination i+j+k equal zero? YES Place vector i j k into s. Was that the last i j k combination? YES Is the front array element less than the back array element? YES Test the next array element Put the rows in the ss vector NO NO NO NO YES Test a new combination for i+j+k Swap the two elements. Was that the last element of the last row? YES Are the two columns of the same row the same? NO Then the rows are not equivalent! Is that the last row in the vector? YES NO Test the next column NO Is it the last column of the row? Test the next two rows YES The rows are equivalent! Do not print one of the rows in ss