A thing I just realized when talking to a colleague who isn't an engineer: you know how there is an O(N) way and an O(N^2) way to answer the question "Which lines in this CSV file have an email address which is not unique in the file?" ? Well:
-
Show this thread
-
The primary beneficiary of the O(N) solution isn't the computer; it's you. The O(N) solution, if you know how to do it, is faster and easier to write, easier to reason about, and easier to extend. (The actual problem was slightly more involved than this gloss, as it often is.)
3 replies 1 retweet 10 likesShow this thread -
(If you're wondering what this O(N) vs O(N^2) thing means: it's notation used in computer science to describe the asymptotic time complexity of an algorithm. That's a mouthful. In less specialized language, the distinction is "Do I have to compare every item to every other one?")
2 replies 0 retweets 8 likesShow this thread -
"How do you tell than a list with 100,000 words in it doesn't include a duplicate without checking each word against every other word, Patrick?" Excellent question! Answer: you stuff each word as you're checking it into hash table and then you only have to go through list once.
10 replies 0 retweets 37 likesShow this thread -
Replying to @patio11
Is this generally true? The lower the order of the computational complexity, the easier it is to write/reason about/extend?
1 reply 0 retweets 0 likes
Nope, but happens to be true for this case.
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.