Skip to content

chrisavl/treap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Treap data structure for Erlang

This is an implementation of a Treap for Erlang, a data structure for key-value pairs. It is essentially a balanced binary tree which also maintains the heap property over a randomized priority value for each key.

The treap module lets you split and merge treaps efficiently. It also lets you set or update the priority of a key in the treap manually, to speed up access to commonly accessed keys. Although in most cases gb_trees/dict should be faster than the treap module.

You can benchmark it versus other common data structures by running:

$ wget http://learnyousomeerlang.com/static/erlang/keyval_benchmark.erl && patch < benchmark.patch 
$ erl -pa ebin
> c(keyval_benchmark).
> keyval_benchmark:bench(100000).

Usage

Pretty much the same as the dict module, check the source for exports/functions. It is < 200 lines :)

About

A key-value data structure for Erlang

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages