Re:Unused Arguments Aren't a Problem When Recursing Right?
by vikiomega9 on Saturday November 07, 2015 @04:56AM
(#10524317)
Sorry, how is this O(m*n)?
[ Parent
| on HN ]
Re:Unused Arguments Aren't a Problem When Recursing Right?
by belovedeagle on Saturday November 07, 2015 @05:41AM
(#10524395)
Hmmm... represent the parameters as nodes in a directed graph. For each of m recursive call sites, process each of n parameters and add edges from formal parameter name to passed argument (i.e., if we have signature foo(a,b,c) and recursive call foo(c,b,c), add edge a->c; self-edges are unimportant). This step is O(mn). Then, assuming we already know what parameters are used outside of function calls, flood-fill the graph from those nodes; this is O(n). O(mn+n)=O(m*n).
Re:Unused Arguments Aren't a Problem When Recursing Right?
by vikiomega9 on Saturday November 07, 2015 @08:51AM
(#10524770)
> "Then, assuming we already know what parameters are used outside of function calls"
This is something that needs to be done, I guess my confusion was that you already have this information and that should be sufficient to finding the unused parametres.