Question
On most telephone keypads the letters of the alphabet are mapped to various digits. In order to make their phone numbers more memorable, service providers
On most telephone keypads the letters of the alphabet are mapped to various digits.
In order to make their phone numbers more memorable, service providers like to find numbers that spell out some word (called a mnemonic) appropriate to their business that makes that phone number easier to remember. For example, the phone number for a physician called Smith could be 377 -6484 (DRSMITH). Write a method listMnemonics that will generate all possible letter combinations that correspond to a given number, represented as a string of digits using a recursive function. This is a recursive backtracking problem, but you are trying to find all the "solutions", not just one. In fact you are trying to find all possible Strings using the English alphabet, not just Strings that are actual "words".
For example, if you call the method listMnemonics with the value 623 your method shall generate and return the following 27 possible letter combinations that correspond to that prefix: MAD MBD MCD NAD NBD NCD OAD OBD OCD MAE MBE MCE NAE NBE NCE OAE OBE OCE MAF MBF MCF NAF NBF NCF OAF OBF OCF Note, the order of these returned strings is unimportant.
Use the GUI depicted above to input required data. (you do not have to input a 7 10 digit number. Three digits will suffice) I will let you decide how you wish to display the out from the inputted string.
Please add comments to your program!
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