title: Suggestion for a data structure for ranking users based on scores
body: <p>I'm looking to use create and maintain the ranks in memory.</p>
  
  <p>Scores associated with user ids and ranks are computed based on the scores.  The following functionality should be supported.</p>
  
  <ul>
  <li>Sort ranks based on scores ascending or descending. Insertion or deletion in O (log n) time.</li>
  <li>Given a user id, lookup user’s rank/score along with n preceding and succeeding ranks in O(log n) time. E.g. get ranks of user 8347 with 5 preceding and succeeding ranks. </li>
  <li>Retrieve n number of ranks from any offset x. E.g. get 100 ranks starting from 800</li>
  </ul>
  
  <p>Given these requirements, are there any suggestions on which data structure suits these requirements the best?</p>