treap balanced binary search tree implementation in Go

313 views
Skip to first unread message

Patrick Crosby

unread,
Dec 6, 2011, 5:12:35 PM12/6/11
to golang-nuts
We're open sourcing some of the code that powers StatHat.

The first release is an implementation of a treap data structure in
Go. It is very similar in usage to Petar's GoLLRB package. Please
check it out:

http://www.stathat.com/src/treap

Most of StatHat is written in Go, so we will release several more
packages of interest to the go-nuts list in the near future.

Thanks!

Patrick
--
Founder | www.stathat.com | www.twitter.com/stat_hat

John Asmuth

unread,
Dec 6, 2011, 5:19:24 PM12/6/11
to golan...@googlegroups.com
Can you comment on what makes it different? Is there a reason (beyond not-invented-here) you didn't use GoLLRB? I have used GoLLRB for a while and I've always been pretty happy with it.

- John

Patrick Crosby

unread,
Dec 6, 2011, 5:54:39 PM12/6/11
to golan...@googlegroups.com
GoLLRB is great and there's no reason you should switch.

We thought the idea behind treaps was an elegant solution to our
problem, so we implemented it. We liked the interface that GoLLRB
provided, so we mimicked it in our implementation.

One thing we added to the treap package is to allow you to iterate
using an overlap function, so you can get all the keys in [3,9), for
example. We use this a lot, often with a struct as the key.

Patrick

Rob 'Commander' Pike

unread,
Dec 6, 2011, 5:58:28 PM12/6/11
to Patrick Crosby, golang-nuts

On Dec 6, 2011, at 2:12 PM, Patrick Crosby wrote:

> We're open sourcing some of the code that powers StatHat.
>
> The first release is an implementation of a treap data structure in
> Go. It is very similar in usage to Petar's GoLLRB package. Please
> check it out:
>
> http://www.stathat.com/src/treap
>
> Most of StatHat is written in Go, so we will release several more
> packages of interest to the go-nuts list in the near future.

Cool! But if StatHat is in Go, why isn't Go supported? It's not mentioned on the landing page, at least.

-rob


Patrick Crosby

unread,
Dec 6, 2011, 6:02:45 PM12/6/11
to Rob 'Commander' Pike, golang-nuts
Thanks!

We'll have the Go StatHat package up very soon and the landing page
will be updated...

Patrick

Reply all
Reply to author
Forward
0 new messages