Case Study
Autocomplete
2024
- Java
- Data Structures
- Algorithms
- JUnit/Testing
Built multiple implementations of the autocomplete operation and compared how different data structures handle prefix queries, sorting, and returning the top matches.
Problem & Motivation:
Efficiently support the autocomplete operation: given a prefix, return terms that start with that prefix, sorted by their weights.
Data & Approach:
- Started with simpler baseline implementations to establish correctness before focusing on performance.
- Implemented additional data structures to support faster lookup of all terms that share a given prefix.
- Ensured results were sorted correctly and returned in the proper order required by the specification.
- Used the provided tests, including corner cases and larger input files, to verify behavior.
Results:
- All implementations produced correct matches for prefix queries and returned results in the required sorted order.
- Observed clear differences in runtime depending on how each structure stored and accessed its terms.
Limitations:
Focused only on prefix-based matching and the operations defined in the project; does not support extensions such as approximate matching or full-text search.