retrieve: Retrieve the value associated with a given key

Description Usage Arguments Examples

Description

If the key exists in the tree, retrieve returns the associated value. Otherwise, retrieve returns NULL.

Usage

1
2
3
4
retrieve(tree, key, ...)

## S3 method for class 'bst'
tree[key]

Arguments

tree

A bst

key

The key to search for

...

Ignored

Examples

1
2
3
4
5
mytree <- bst()
mytree <- insert(mytree, "a", 7)
retrieve(mytree, "a")
# can also use subset operator
mytree["a"]

tarakc02/rbst documentation built on May 31, 2019, 3:55 a.m.