Skip to content

siscia/sorted_set

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SortedSet

Hex.pm Travis

A sorted set library for Elixir. Implements the Set protocol.

Installation

Add the following to deps section of your mix.exs: {:sorted_set, "~> 1.0"}

and then mix deps.get. That's it!

Generate the documentation with mix docs.

About

Sorted sets are backed by a red-black tree, providing lookup in O(log(n)). Size is tracked automatically, resulting in O(1) performance.

Basic Usage

SortedSet implements the Set behaviour, Enumerable, and Collectable.

SortedSet.new()
|> Set.put(5)
|> Set.put(1)
|> Set.put(3)
|> Enum.reduce([], fn (element, acc) -> [element*2|acc] end)
|> Enum.reverse
# [2, 6, 10]

About

Sorted Set library for Elixir

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Elixir 100.0%