All Projects → dmcmanam → bbst-showdown

dmcmanam / bbst-showdown

Licence: GPL-3.0 License
Fast AVL Trees & WAVL Trees in Java

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to bbst-showdown

ds
🔗 Common Data Structures and Algorithms
Stars: ✭ 40 (+66.67%)
Mutual labels:  red-black-tree, balanced-search-trees
Gods
GoDS (Go Data Structures). Containers (Sets, Lists, Stacks, Maps, Trees), Sets (HashSet, TreeSet, LinkedHashSet), Lists (ArrayList, SinglyLinkedList, DoublyLinkedList), Stacks (LinkedListStack, ArrayStack), Maps (HashMap, TreeMap, HashBidiMap, TreeBidiMap, LinkedHashMap), Trees (RedBlackTree, AVLTree, BTree, BinaryHeap), Comparators, Iterators, …
Stars: ✭ 10,883 (+45245.83%)
Mutual labels:  avl-tree, red-black-tree
lua-algorithms
Lua algorithms library that covers commonly used data structures and algorithms
Stars: ✭ 57 (+137.5%)
Mutual labels:  red-black-tree, balanced-search-trees
avl array
High performance templated AVL tree using a fixed size array. Extensive test suite passing.
Stars: ✭ 33 (+37.5%)
Mutual labels:  avl-tree
Lock-free-Red-black-tree
Implementation of lock-free red-black tree using CAS
Stars: ✭ 21 (-12.5%)
Mutual labels:  red-black-tree
Libft
42 library of basic C functions - queues, lists, memory operations and more 😄
Stars: ✭ 21 (-12.5%)
Mutual labels:  red-black-tree
data-structures-algorithms
Self-practice in Data Structures & Algorithms
Stars: ✭ 29 (+20.83%)
Mutual labels:  avl-tree
Libdict
C library of key-value data structures.
Stars: ✭ 234 (+875%)
Mutual labels:  avl-tree
Pomegranate
🌳 A tiny skiplist based log-structured merge-tree written in Rust.
Stars: ✭ 20 (-16.67%)
Mutual labels:  skiplist
AVL-Tree
Implementation of an AVL tree in Java
Stars: ✭ 20 (-16.67%)
Mutual labels:  avl-tree
Algorithms
Java implementation for Introduction to Algorithms book.
Stars: ✭ 58 (+141.67%)
Mutual labels:  red-black-tree
interval-tree
A C++ header only interval tree implementation.
Stars: ✭ 38 (+58.33%)
Mutual labels:  red-black-tree
py-skiplist
Pure python implementation of a skiplist data structure
Stars: ✭ 31 (+29.17%)
Mutual labels:  skiplist
avl tree set rs
Rust repository for the my article: Understanding Rust Through AVL Trees
Stars: ✭ 31 (+29.17%)
Mutual labels:  avl-tree
go-avltree
AVL tree with some useful extensions written in Go
Stars: ✭ 29 (+20.83%)
Mutual labels:  avl-tree
BokkyPooBahsRedBlackTreeLibrary
BokkyPooBah's Red-Black Binary Search Tree Library
Stars: ✭ 117 (+387.5%)
Mutual labels:  red-black-tree
cstl
STL style library with red-black tree implementation in C
Stars: ✭ 34 (+41.67%)
Mutual labels:  red-black-tree
consistent-hashing
an implementation of Consistent Hashing in pure Ruby using an AVL tree
Stars: ✭ 40 (+66.67%)
Mutual labels:  avl-tree
SkipListPro
Probably the best implementation for SkipList written by C++
Stars: ✭ 81 (+237.5%)
Mutual labels:  skiplist
TUMGAD
Exercise generator and helpful materials for the Introduction to Algorithms and Data Structures 📚
Stars: ✭ 27 (+12.5%)
Mutual labels:  avl-tree

bbst-showdown

Performance of WAVL, AVL & Red-black trees compared in Java.

Because AVL trees enforce stricter balance requirements than red-black trees, performance of AVL trees is substantially better when sequential elements are inserted and nearly identical for random insertions. 'AVL tree implementations were consistently faster than red-black trees, by up to 20%' in the detailed 2004 analysis by Ben Pfaff- https://benpfaff.org/papers/libavl.pdf Comparing implementations from this project, the difference can be over 30% - https://refactoringlightly.wordpress.com/

What is fascinating about AVL trees is that although they were originally described in a paper from 1962, interesting variations were published in 2015(WAVL) and 2016(RAVL), http://sidsen.azurewebsites.net// so there remains a great coding opportunity to elegantly implement and explore the possibilities described in recent papers.

Specifically, rank balanced AVL trees are still not common so this project explores their implementation and various common AVL tree implementations such as balance factor.

Balanced binary trees such as red-black, AVL and RAVL can have a reputation for being difficult to code, that may have been the case in the 90s when coding them from a textbook or a research paper but with modern tools and resources the difficulty has decreased. Take a look at the fixAfterInsert() method for TreeMapRAVL which uses rank and rank difference to build an AVL tree for an example of a fairly simple insert retracing loop.

The AVL vs. Red-black Tree History

Unfortunately, red-black trees are the default implementation in Java, the Linux kernel and the C++ standard library. Why? For random inserts, AVL trees perform .7 rotations per insert while red-black trees perform .6 rotations per insert. Therefore, in a 1990s world of costly memory access it was commonly ASSUMED that red-black trees would perform better for insert intensive tasks while AVL would perform better on lookup intensive tasks. This type of statement, totally based on assumptions about the cost of rotations, is still common within many internet discussion groups. On modern computers, rotations are a poor metric for performance - tree height, average node height and comparisons required per operation are much better benchmarks. Also, the popular CLR algorithms textbook does not cover AVL trees, an issue I expect they will correct in future editions given current research.

I welcome your input on this project.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].