timer Asked: Jan 18th, 2021

Question Description

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

Student has agreed that all tutoring, explanations, and answers provided by the tutor will be used to help in the learning process and in accordance with Studypool's honor code & terms of service.

This question has not been answered.

Create a free account to get help with this and any other question!

Brown University

1271 Tutors

California Institute of Technology

2131 Tutors

Carnegie Mellon University

982 Tutors

Columbia University

1256 Tutors

Dartmouth University

2113 Tutors

Emory University

2279 Tutors

Harvard University

599 Tutors

Massachusetts Institute of Technology

2319 Tutors

New York University

1645 Tutors

Notre Dam University

1911 Tutors

Oklahoma University

2122 Tutors

Pennsylvania State University

932 Tutors

Princeton University

1211 Tutors

Stanford University

983 Tutors

University of California

1282 Tutors

Oxford University

123 Tutors

Yale University

2325 Tutors