(August 2, 2015 at 9:18 am)Aractus Wrote: I would use a container method. For word size n, for example where n=4:
ABCD
n1(n2(n3(n4))) ... n1(n4( ... )) ... n2 ... n4
I'm sorry,i'm not familiar with the concept of a container method.Anyhow i'd be much appreciative if you could provide me with a pseudo code or an algorithm.
(August 2, 2015 at 9:21 am)vorlon13 Wrote: Found this, if you change the 'digit map' it will do what you want apparently. (I'm not familiar with 'Python', BTW)
digit_map = {
'2': 'abc',
'3': 'def',
'4': 'ghi',
'5': 'jkl',
'6': 'mno',
'7': 'pqrs',
'8': 'tuv',
'9': 'wxyz',
}
def word_numbers(input):
input = str(input)
ret = ['']
for char in input:
letters = digit_map.get(char, '')
ret = [prefix+letter for prefix in ret for letter in letters]
return ret
Thanks,but god that looks ugly,i can't make sense of the code probably because i'm not familiar with that language,i don't really want the code,i just want the algorithm or pseudo code.
P.S. I'm using c,not that it helps,just saying.