- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Perhaps I'm just missing something, but where does
i
come from? Wait, scratch that, where doesdata
come from? I'm thinking some obfuscation has occurred!Filed under: there is no cow level
Admin
There is a belief that if you keep looking once you've found what you're looking for you might find gold.
Admin
Sounds like you be coming from the west country me old beauty.
Admin
No, that would be "Where be I coming from, me lover?"
Admin
https://www.youtube.com/watch?v=9auOCbH5Ns4
Admin
Well I could make this O(n^m) for arbitrary m pretty easily just by re-writing either DestnameToDest, or more insidiously DbGetNext, but I'm feeling lazy today.
Admin
Solve one problem, create another: Code snippets are not equal. Original code finds LAST match, new code finds FIRST match !
Admin
That reminds me of a bug I need to find time to fix…
Admin
I assume adding some sorting statement to the data fetching function will fix that.
Admin
https://www.youtube.com/watch?v=EiO9_PJ0h8Q
Admin
It's the "still seems reasonable" clause that makes it impossible to implement the following algorithm for searching a list (in pseudocode):
That will work with an average speed of o(n^2*log n) assuming a fair shuffle function, unless of course search_term isn't in the list in which case the program will not halt.
Admin
That's eerily similar to little ms. flabdablet's method for tracking down lost toys and items of clothing.
Admin
Reminds me of someone's response (in a blog, not an actual interview) to "write code to extract a square root without using any math library," which went, more or less. {find square root of x} while TRUE y = random() if abs(y^2-x) < eps; break continue
Admin
How does one actually find the square root? We were never told this in any math class I've attended...
Filed under: Oh, well just use this table of 4-significant-digit results if you don't have a calculator
Admin
there are multiple ways, but one common one is:
sauce
Admin
The standard algorithm is an application of Newton-Raphson, which converges fast and is actually pretty easy to code to high standard.
https://en.wikipedia.org/wiki/Newton%27s_method#Square_root_of_a_number
Admin