title: Finding the squares in a plane given n points
body: <p>Given n points in a plane , how many squares can be formed ...??</p>
  
  <p>I tried this by calculating the distances between each 2 points , then sort them , and look for the squares in the points with four or more equal distances after verifying the points and slopes. </p>
  
  <p>But this looks like an approach with very high complexity . Any other ideas ...??</p>
  
  <p>I thought dynamic programming for checking for line segments of equal distances might work ... but could not get the idea quite right ....</p>
  
  <p>Any better ideas???</p>
  
  <p>P.S : The squares can be in any manner . They can overlap , have a common side, one square inside another ... </p>
  
  <p>If possible please give a sample code to perform the above...</p>