February 8, 2016
Possible triangle
http://www.geeksforgeeks.org/find-number-of-triangles-possible/
http://stackoverflow.com/questions/8110538/total-number-of-possible-triangles-from-n-numbers
Argue about how to reduce time complexity from O(N^3) to O(N^2), how exactly i, j, k three variable, k is only from 0 to n-1 once for each i, nothing to do with j. So, it is time for i - from 1 to N, and time for j from 1 to N two loops, and then for i - N, and k from 1 to N ( skip j - big point! Cannot figure out easily. )
To be continued.
No comments:
Post a Comment