title: How to calculate number of repeated elements in a 1D array?
body: <p>I have a double array with size N with elements calculated by the code. And looks something like this:</p>
  
  <p>a, b, a, a, b, c,...</p>
  
  <p>So it has duplicate elements. For example a is repeated 10 times, b is repeated 12 times etc.</p>
  
  <p>I want to output something like this:</p>
  
  <p>a : 10</p>
  
  <p>b : 12</p>
  
  <p>What would be a good algorithm to do this?</p>