djburdick
djburdick

Reputation: 11940

binary search trees in ruby

Is there a reason why I don't see binary search trees used much in Ruby?

Is there an equivalent data structure or class that people typically use instead?

I'm not trying to solve a specific problem; just trying to learn more about the language.

thanks!

Upvotes: 5

Views: 3199

Answers (1)

Mark Reed
Mark Reed

Reputation: 95252

Binary search trees are a relatively low-level implementation detail, usually for a map/table abstract data type. In Ruby, if you want a map/table, you just use a Hash. If you have a problem that specifically needs binary search trees, there's also a good chance a Ruby implementation will be too slow to be useful.

Upvotes: 6

Related Questions