Find an Online Tutor Now

Asked • 03/14/19

Hashset vs Treeset?

I've always loved trees, that nice `O(n*log(n))` and the tidiness of them. However, every software engineer I've ever known has asked me pointedly why I would use a `TreeSet`. From a CS background, I don't think it matters all that much which you use, and I don't care to mess around with hash functions and buckets (in the case of `Java`). In which cases should I use a `HashSet` over a `TreeSet`?

1 Expert Answer


Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.


Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.