TernarySearchTreeAutocomplete

0 comments

TernarySearchTreeAutocomplete

Implement the following two methods TernarySearchTreeAutocomplete.java

1) void addAll(Collection<? extends CharSequence> terms)
Adds all of the terms to the autocompletion dataset. Each term is a CharSequence that represents a potential autocompletion option. The order of the terms in the collection is arbitrary. Behavior is undefined if duplicate terms are added to the dataset.
2) List<CharSequence> allMatches(CharSequence prefix)
Returns a list of all terms that begin with the same characters as the given prefix. Given the terms [alpha, delta, do, cats, dodgy, pilot, dog], allMatches("do") should return [do, dodgy, dog] in any order.
Below I have provided the full workspace, SimpleExample.java runs a reference implementation, Modify the class to test your own implementation for debugging purposes, and check that it lines up with the matches returned by the given reference implementation

About the Author

Follow me


{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}