title: find most occurence element in array
body: <p>Here is simple program to find the element which occurs most often in an array:</p>
  
  <pre><code>#include &lt;cstdlib&gt;
  #include &lt;iostream&gt;
  #include &lt;vector&gt;
  
  using namespace std;
  
  int main(int argc, char *argv[]) {
      int a[] = {1,2,3,4,4,4,5};
      int n = sizeof(a) / sizeof(int);
      int max = 0;
      int result = 0;
      int *b = new int[n];
      for (int i = 0;  i &lt; n;  i++) {
          b[a[i]] = (b[a[i]] || 0) + 1;
          if (b[a[i]] &gt; max) {
              max = b[a[i]];
              result = a[i];
          }
      }
      cout &lt;&lt; result &lt;&lt; endl;
      system("PAUSE");
      return EXIT_SUCCESS;
  }
  </code></pre>
  
  <p>But it doesn't work; it prints <code>1</code>.  Why?</p>