container-avltreelist
Advanced tools
Comparing version 0.1.0 to 0.1.1
{ | ||
"name": "container-avltreelist", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "AvlTreeList implementation in JavaScript", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -7,4 +7,4 @@ # container-avltreelist | ||
To manage a pool of sorted elements. **Complexity in O(log2(n)) for addition and removal**. | ||
Plus, complexity in O(1) in the best case for repositioning an element when updating its sorting property. | ||
This container is best used for managing a list of element sorted where the values of the properties on which the ordering depends change slowly over time. | ||
Plus, ***complexity in O(1)*** in the best case ***for repositioning an element*** after updating its sorting property. | ||
This container is best used for managing a list of element sorted when the values of the ordering properties change slowly over time. | ||
@@ -70,5 +70,6 @@ To **instantiate** a new tree: | ||
myObject.zIndex = 10; // sorting property (here zIndex) of element changed | ||
myTree.reposition(myObject); | ||
myTree.reposition(myObject); // repositioning object with respect to new sorting property value | ||
``` | ||
Note 1: ```reposition``` method is in O(1) in the best case, and O(n) in worst case, depending on how much the value of sorting property changed | ||
Note 2: It is important to attach the object reference on the ```_avlTreeListReference``` property of the object | ||
***Note 1***: ```reposition``` method is in O(1) in the best case, and O(n) in worst case, depending on how much the value of sorting property changed. | ||
***Note 2***: It is important to attach the object reference on the ```_avlTreeListReference``` property of the object. |
15118
74