new SkipList(compareFn)
Example
var SkipList = require("dsjslib").SkipList var skl=new SkipList([compareFn])
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
compareFn |
userCompareFn |
<optional> |
User provided comparator for keys. If not provided, a natural ordering is assumed |
- Source:
Methods
-
delete(key)
-
Remove key and all nodes representing the key
Parameters:
Name Type Description key
* - Source:
-
entrySet() → {Array}
-
Get all entries(sorted). They are returned as key value pair objects
- Source:
Returns:
Array of objects {key:
,value: } - Type
- Array
-
get(key) → {Object}
-
Get value for the key
Parameters:
Name Type Description key
* to search for
- Source:
Returns:
{key:
,value: } if key exists, null otherwise - Type
- Object
-
put(key, value) → {SkipList}
-
Add a key value pair, if the key exists value is replaced
Parameters:
Name Type Description key
* value
* - Source:
Returns:
this
- Type
- SkipList