5

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!

1 Answer 1

6

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.