Re:My toughest job-interview question ever
by biohacker42 on Tuesday May 12, 2009 @10:37AM
(#605423)
Yeah that's what struck me about this, who drills tech writers on hash algorithm? There's tough interview questions, and there's stuff that's hardly relevant.
The grand parent is right, this is a horrible programming solution but the author is not a programmer!
He prattled on at lenght when he had little real understanding of the toppic at hand. He ignored cleaning up the data and assumed you needed a complex hash for words when you could just the digtits of the word for the same thing.
(((A * 27) + B) * 27)+C) then a datastructure for count and the next Hash table if needed. Use this recursivly and you can handel just about any word and get there with (Length/3) looks at main memory. And you can still alocate all that memory in a few large chunks so that's still fast.
Then optomize for speed or memory as need. (If you don't mind sacrificing space you use 32bits per letter and then bit shift etc.)
because of that a shortcut answer would have been to delegate the issue to the CS department as sorting words is not a task for a tech writer. Nice that he identified the question as being off-topic. Poor that he didn't dismiss it because of that.
I'm somewhat amazed that he could answer it even to the extent he did. Most tech writers I've worked with do not have the (apparent) level of technical knowledge this guy has.