News for hackers. Stuff that matters.
Re:Aguri: Coolest Data Structure You've Never Heard Of by bayareaguy on Tuesday January 22, 2008 @08:28AM (#102169)
Hash tables are NOT O(1). You just failed the job interview.

tptacek, what do you think they are?

Re:Aguri: Coolest Data Structure You've Never Heard Of by tptacek on Tuesday January 22, 2008 @01:26PM (#102310)
The bound on lookup from a hash table is O(n).
Re:Aguri: Coolest Data Structure You've Never Heard Of by bayareaguy on Tuesday January 22, 2008 @07:16PM (#102519)
As is the worst case in a binary tree.
Re:Aguri: Coolest Data Structure You've Never Heard Of by tptacek on Tuesday January 22, 2008 @08:19PM (#102547)
If you use a simple binary tree, which nobody does, you're right. If you use a red-black tree, like everybody does, you're wrong; worst case search time for a balanced binary tree is O(log n).

Worst case search for a radix trie is always O(k); radix tries don't require balancing.

Where did you go to school?

Re:Aguri: Coolest Data Structure You've Never Heard Of by bayareaguy on Tuesday January 22, 2008 @10:29PM (#102595)
Well, nobody I know uses hash tables without periodically "rebalancing" them either.

Where I went to school, we were taught not to compare the worst case behavior of one structure to the average of another. We were also taught not to confuse binary trees with red-black trees.

Re:Aguri: Coolest Data Structure You've Never Heard Of by ckuehne on Wednesday January 23, 2008 @04:03AM (#102719)
I guess your school sucked. Red-black trees ARE binary search trees. Also: the worst case behavior of a hash table is in fact worse than that of a balanced (red-black tree, b-tree, avl-tree) search tree.
Re:Aguri: Coolest Data Structure You've Never Heard Of by bayareaguy on Wednesday January 23, 2008 @07:21AM (#102758)
Red-black trees ARE binary search trees.

Agreed. However the original poster said binary tree, a specific structure whose worse case behavior is O(n) just like a hash table.

They didn't say binary search tree (which as you observe may refer to one of several possible structures).

Re:Aguri: Coolest Data Structure You've Never Heard Of by tptacek on Wednesday January 23, 2008 @12:25AM (#102647)
Your school taught you to "balance" hash tables?
Re:Aguri: Coolest Data Structure You've Never Heard Of by bayareaguy on Wednesday January 23, 2008 @07:22AM (#102759)
The quotes were there for a reason.