Hello... Now let me see... 1 600 * 1 600 = 2 560 000, if each comparison is a milisecond... 1600 * 1600 * (1 ms) = 42,6666667 mins, that's way they say hash! Ok, if you really, really don't want to use hash... and still want a better result that 42 mins and so, try a Tree... but the nature of that tree relies in the meaning of "reducible".
Well, you can always do a HashSet for your Words, with a custom GetHash function, it isn't that hard. .NET 3.5 has a HashSet class, if you are stuck in .NET 2.0 search for the code of the HashSet from Mono Project, that will do, if you are stuck in .NET 1.1 then quit, get a new operating system, buy a new computer, or suicide. I don't know what you mean by "reducible" here, but I undertand that you somehow need to compare the words you have in a list. If you can afford to compare then in pairs (each one to each one), you may try creating a class for "word", with IComparable or IEquatable (that will allow you to define a custom way to compare the word instances), and then use a common List<word> to store the list, and the Contains method, which will use your Compare or Equals method if available. Now it will be like reading the words (from a file? each word a line?) and then for each one create a word instance with the string you read, and then ask your list if it contains (an instance equals [in the terms you define] to) the instance you just created, if not then add it to your list. Does that suite you? And for how to write your Compare/Equals/GetHash function... well, tell me, how reducible are those words? Note: Even if not completely correct semantically you can use your Compare/Equals/GetHash to alter (reduce?) the content/value/status of the word instances. It will be ok, if the modification is not visible from the properties of the class and if the result of the Compare/ Equals/GetHash will not be afected by the modifications. The last thing I can tell you is to google the nouns I wrote with an initial capital leter, except "I" of course. And always in the context of the language you are using, which ever it is (and I don't mean english). Theraot On 13 mayo, 11:42, S <[email protected]> wrote: > Hello all, > I have a list of words (about 1600) and all of them are > reducible to some extent. So if I have this list, what would be the > best way to put them in the list to compare as I reduce them. I > thought of hash function but that just seem to be a optimal solution. > Is there anyone who can give some inputs for the same ? > > I havent done any such programming and I am out of ideas > so anything would be appreciated. > > Thanks in advance > > -S
