I'm creating a trie, which my application will hold in it memory. Trie will have a lot of nodes and I'm thinking about how to reduce space usage. Of cause I will use trie to DAWG algorithm to reduse number of nodes, but as far as I know it's not enough.
Here is a node class
class Node{
char letter;
boolean EOW; // end of word
Node child; // first child
Node next; // next Node on this level
}
As far as I know object of this class will have 14 Bytes (2 Bytes given for char, 4 for boolean variable and 2*4 will be reserved for references)
I think that I can replace char by byte. That will save 1 Byte. However I don't know how much time that will take in type casting. And likely this is a bad desigin.
Also boolean takes 4 Bytes, perhaps you know what I can use instead of boolean?
So I need you to help me reduce size of nodes. Thanks in advance.