On Sun, May 8, 2011 at 8:58 PM, Jisun Jung <jj...@cornell.edu> wrote:
> When we call contains method for some list of size n, should that count as
> O(n)? Or can we disregard it?
I think the question was, "Can you assume that the complexity of O(n)
for a subroutine doesn't matter when trying to analyze the routine which
uses the subroutine." The answer is: Your running time analysis MUST
include the analysis of the subroutines you call. If you call the
contains method x times on a list of size n, then your running time is
O(xn).
-Robert