greatnose
BAN USERinit time is o(n)
random value generation's time complexity is o(1) and space complexity is o(1)
1. create function for prime generation. f(min) is 2, f(min+1) is 3, f(min+2) is 5 ... f(max)
2. go through the whole array. get one big data t = f(array[0]) * f(array[1]) *... f(array[n])
3. generate one random value x . if t mod x != 0, it didn't appear in this array.
1. Assign new field for every word in dictionary. Like long integer. every char's index as one mulitply . for example, ahead = 2x 9 x 6 x 2 x 5. Reorder the whole dictionary as this key value.
2. Parsing input string one by one. and computer the value. If the value is the same with one word's key of dictionary. Regard it is one word in dictionary.
3. There is some conflict that some words share the same values. It need do word matching.
sorry, it is one typo. It shall be o[n]
- greatnose January 22, 2013