File: README.md

package info (click to toggle)
ruby-avl-tree 1.2.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 184 kB
  • sloc: ruby: 2,179; makefile: 4
file content (42 lines) | stat: -rw-r--r-- 1,003 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# AVL tree, Red-black tree in Ruby

avl_tree - AVL tree, Red-black tree and Lock-free Red black tree in Ruby
Copyright (C) 2014 Hiroshi Nakamura <nahi@ruby-lang.org>


## Usage

You can use AVLTree, RedBlackTree or ConcurrentRedBlackTree just as a
replacement of Hash.

    @points = Hash.new
    ...
    @points[score] = person
    ...
    @points.each do |score, person|
      ...
    end

    ->

    require 'avl_tree'
    @points = AVLTree.new

    require 'red_black_tree'
    @points = RedBlackTree.new
    @points = ConcurrentRedBlackTree.new

AVLTree and RedBlackTree are faster but not thread-safe.  Use ConcurrentRedBlackTree in multi-thread environment.

## Author

Name:: Hiroshi Nakamura
E-mail:: nahi@ruby-lang.org
Project web site:: http://github.com/nahi/avl_tree


## License

This program is copyrighted free software by Hiroshi Nakamura.  You can
redistribute it and/or modify it under the same terms of Ruby's license;
either the dual license version in 2003, or any later version.