12/2/08, 22:59
If you are ever interviewed by me and I happen to ask you, say, to write a function that returns the nth element in the Fibonacci Series, you had better not give me the recursive solution.
It appears that about 90% of the people asked this give this solution straight away, without asking the examiner anything about efficiency. I find this appalling.
Even if efficiency is not always the number one criteria (or even in the top 5), in this instance the recursive solution is much worse (exponential VS linear complexity) than the non-recursive solution AND is not much simpler to code. The difference is about 3 lines of code.
I expect programmers to anticipate and consider such concerns, and even if not asked specifically to give an efficient solution, in such a case they should (unless of course they ask the examiner if efficiency is a concern and get a negative answer).
P.S.
There are some acceptable recursive solutions. For example, from Wikipedia:
public void run(int n)
{
if (n <= 0)
{
return;
}
run(n,1,0);
}
private void run(int n, int eax, int ebx)
{
n–;
if (n == 0)
{
System.out.println(eax+ebx);
return;
}
run(n,ebx,eax+ebx);
}
I don’t object to the actual recursion, just to the exponential inefficiency.
11/2/08, 21:37
Lately I see many sites using common misspelling with similar site design to attract users. Today was the first time I was attacked by one such site.
I was searching my own blog on the net to understand who if at all links to it, and got
this dangerous and misleading site. I saw a supposed link to my blog that looked like this (don’t follow this one):
http://technorati.com/blogs/qimmortal.blogspot.com
Clicking it I got a Firefox warning asking if I want to run this “.com” application. Evil bastards.
11/2/08, 13:46
Not faith in God, which cannot actually be refuted by “contradicting evidence”. Rather, faith in some religion and stories, some of which contradict known scientific facts (= theories proven beyond reasonable doubt), like Evolution.
11/2/08, 11:21
Woo Hoo!
I just got the first confirmed reader of my blog which is not someone I know – Mord Shtern (he receives a link to his blog as a modest reward).
I took this chance to look at some Feedburner stats, and there seems to be a jump in reader count since last month.
This might have something to do with the fact that Yoav shared many of my recent posts as interesting in his blog and/or the fact that Zeirman mentioned me and my post about real time strategy games.
Thanks guys 🙂
If you survived this self-absorbed post you get something in return:
8/2/08, 16:06
Here
You haven’t seen anything like it, though I would bet it wasn’t filmed in a single take.
The chess plays are ingenious.
8/2/08, 0:22
Words are bullshit. Words are bullshit because they make us think we know the answer. When we say them, we think we know what we feel because we put it into words. When I write them (I’m writing some right now), it makes me feel I can articulate myself, express how I feel. But I can’t. The image presented by words is always a fake one, even when the words are best-intended.
This is Zen, as much as I understand Zen.
And yet, words are all we have
P.S.
A possibly relevant quote from Albert Camus I just found by accident.
“Do not be surprised. I do not like writers and I cannot stand their lies. They speak so as not to listen to themselves speak. If they did listen, they would know that they are nothing and then they would no longer be able to speak.”
Tags:
Bullshit,
Zen
Comments Off on Something I Wrote Once