title: Calculating sum of all the distance
body: <p>I have been given n points on a line with their locations. I need to sum of distances between each pair of points. Is it possible to do with complexity O(n).</p>
  
  <p>Example: Given three points with their coordinates a(-1), b( -3), c(3).
  Required Sum: 
  |-1 + 3| + | - 1 - 3| + |-3 - 3 | 
  = 12</p>
  
  <p>Please help me.</p>