title: C++ : Data structure for fast searching
body: <p>Following is my scenario:</p>
  
  <p>I have to keep all the 3 byte combinations of the extended ASCII something like this:</p>
  
  <pre><code>{ { (a,a,a),(a,a,b),..........(z,z,z) } }
  </code></pre>
  
  <p>All these combination results in a big set of 256*256*256 values</p>
  
  <p>In my algorithm , it happens that after every iteration the big set breaks into something like this:</p>
  
  <pre><code> {(a,a,a), (a,a,b)}
   {(a,a,c)}
  .
  .
  .
  .
  {(z,z,z)}
  </code></pre>
  
  <p>I am implementing this using vector of set of array.</p>
  
  <pre><code>vector&lt;set&lt;array&lt;char,3&gt; &gt; &gt; Partition;
  </code></pre>
  
  <p>the reason behind using this is that a big set will break into subsets .The number of these subsets is not known and after each iteration the number of subsets may increase therefore I am using vector. Then the subset should not contain any element twice therefore I am making use of set and array is used to keep the 3 characters.</p>
  
  <p>The problem in using the above data structure is that it is taking lot of time in computing the results.</p>
  
  <p>I need suggestions regarding a data structure which can be more efficient in my case.</p>
  
  <p><strong>More explanation of my algorithm:</strong></p>
  
  <pre><code>{(a,a,a),(a,a,b)........ (z,z,z)}
  </code></pre>
  
  <p>All these triplats are keys of an unordered map. All these triplates correspond to a certain value like this</p>
  
  <pre><code>(a,a,a)           value=2
  (a,a,b)           value=2
  (a,a,c)           value=3
  (a,a,d)           value=2
  .
  .
  .
  .
  .
  </code></pre>
  
  <p>Now, I run my algorithm and want to know on the basis of value how much they can be compressed: Like this</p>
  
  <pre><code>{(a,a,a) ,(a,a,b)  }          value=2
  (a,a,c)                       value=3
  {(a,a,d),......}              value=2
  </code></pre>
  
  <p>Why I have to make a separate subset for value=2 because according to my algorithm I have to  make a new set whenever my previous value differs from the present value.</p>