# HG changeset patch # User Eris Caffee # Date 1430500672 18000 # Node ID 2a6239659909d96de5930758206563ab11e7bf9c # Parent b71457723bed41c6b4b5516b3b1e868df5cde8df Expanded comments in two_sum.pl diff -r b71457723bed -r 2a6239659909 two_sum/two_sum.pl --- a/two_sum/two_sum.pl Fri May 01 12:12:07 2015 -0500 +++ b/two_sum/two_sum.pl Fri May 01 12:17:52 2015 -0500 @@ -16,6 +16,11 @@ # the two numbers (along with their indices). Otherwise we add num to the hash # and loop back to read the next input number. +# Overall performance is O(N) in the worst case, since in that case we must +# process each input item exactly once. (For each item, we perform one lookup +# into the hash, which adds only a small constant to the running time per +# iteration of the loop.) + # Usage: Pass the target value as a command line option, and the number array as # values on stdin, one item per line.