title: How to implement z-order sort for coordinates for Quad-Tree bulk insertion - C++
body: <p>According to <a href="http://www.cs.umd.edu/~hjs/pubs/acmgis99.pdf" rel="nofollow">Improved Bulk-Loading Algorithms for Quadtrees</a>, sorting the coordinates in z-order before insert will result in speedup for QuadTree batch insertion.</p>
  
  <p>I need z-order implementation in C++. 
  I have x,y coordinates both <code>double</code>. The solution here in Wikipedia for <a href="http://en.wikipedia.org/wiki/Z-order_curve" rel="nofollow">Z-Order-Curves</a>
  is kind of unclear to me. </p>
  
  <p><strong>EDIT - assumptions</strong>
  The coordinates I have are in google coordinates and are floating point numbers. 
  In the system we currently develop, we assume that any bulk (batch) to be inserted fits in RAM. We don't anticipate the need of external sort operations with swapping between disk and memory.</p>
  
  <p><strong>EDIT 2</strong> 
  with regards to the fact that Z-order works for integers only, I think the trick is to multiple by factors of 10 until all data is integers. Once I have that what is the way to perform z-order on the points?</p>