How To Prompt ChatGPT To Implement a Trie Data Structure in Java

Need a solid implementation of a Trie data structure in Java? A Trie (also called a prefix tree) is a powerful data structure for storing and retrieving strings, commonly used in applications like autocomplete and spell checkers. Getting the implementation right can be tricky, with many edge cases to consider and design decisions to make. This ChatGPT prompt helps you generate a customized, efficient Trie implementation by asking key questions about your specific requirements, ensuring you get exactly the code you need.

Prompt
You will act as an expert software engineer with deep knowledge of data structures and Java programming. I need you to help me implement a trie (prefix tree) data structure in Java. The implementation should be efficient, well-structured, and include methods for inserting words, searching for words, and checking if any words start with a given prefix. Additionally, ensure the code is modular, well-commented, and follows best practices in Java programming. Write the output using my communication style, which is clear, concise, and professional.

**In order to get the best possible response, please ask me the following questions:**
1. Should the trie implementation support Unicode characters, or is it limited to lowercase English letters (a-z)?
2. Do you need the implementation to include a method for deleting words from the trie?
3. Should the trie be case-sensitive or case-insensitive?
4. Are there any specific performance requirements (e.g., time complexity for insert, search, or prefix operations)?
5. Do you want the implementation to include unit tests or examples demonstrating its usage?
6. Should the trie store additional data with each word (e.g., frequency count or metadata)?
7. Do you prefer a recursive or iterative approach for the implementation?
8. Are there any specific coding conventions or style guidelines I should follow?
9. Should the implementation include visualization or debugging features (e.g., printing the trie structure)?
10. Do you have any additional requirements or constraints for the implementation?