searchWord: Search a string

Description Usage Arguments Details Value Examples

View source: R/searchWord.R

Description

Searches for a string within a ternary search tree

Usage

1
searchWord(tree, string)

Arguments

tree

an existing ternary search tree to search words in.

string

a string of characters to search for.

Details

Searches through the tree for the specified string. Returns TRUE if the string have been added to the tree and FALSE if not.

Value

logical. TRUE if the string is in the tree, FALSE if not.

Examples

1
2
3
fruitTree <- newTree(c("apple", "orange","apricot","cherry"))
searchWord(fruitTree, "apricot")
searchWord(fruitTree, "banana")

Example output

Tree created with 4 words and 22 nodes
[1] TRUE
[1] FALSE

TSTr documentation built on May 1, 2019, 9:16 p.m.