I'm a little unclear as to what hashing is exactly. I'm in the process of writing a word jumbling program and I came up with a scheme to compare a large number of words fairly quickly. I want to know if the following is a true form of hashing.
I got the idea from a letter frequency count algorithm. It seemed like there would be far too many for loops in it for me. So I came up with this. Instead of using arrays, I would use bit fields. I reserve 28 bits. 26 for each letter of the alphabet, and 2 unused bits just to make it a multiple of four (4bits/byte).
The word "cats" would be encoded like this:
Now, with a simple bitwise &, I can match all possible permutations AND lengths in one if(). (i.e. cats, cat, cast, a, act, at, sac, etc);Code:**abcdefghijklmnopqrstuvwxyz 0010100000000000000011000000
In case you want to tell me this won't work, forget about the actual frequency of each letter. All I'm concerned with here is if contains AT LEAST one occurence of the letter. It will still match no matter how many occurences there are, but will have to be verified after the match is made.
Would this be considered hashing or not?