Question
Write a program that simulates a translation dictionary. Your program must be able to support any number of words and multiple languages. All translations should
Write a program that simulates a translation dictionary. Your program must be able to support any number of words and multiple languages. All translations should be done as efficiently as possible, and it must be able to translate between any two languages. Your code should not care what languages exist in the dictionary it should be possible to add more languages by changing the code in init(), and not touching the code in translateWord(). Indicate the time complexity of your algorithm. Hint: You may want to use a map of maps. public class Dictionary { public void init() { // Create your data structure, and add some words } public String translateWord(String word, String srcLanguage, String destLanguage) { // Translate the word } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started