title: data structure for sorted browsing history
body: <p>Suppose i want to implement the browser history functionality. If i visit the the url for this first time it goes into the history , if i visit the same page again it comes up in the history list. 
  lets say that i only display the top 20 sites, but i can choose to see history say for the last month , last week and so on . </p>
  
  <p>what is the best approach for this ? i would use hash map for inserting / checking if it is visited earlier , but how do i sort efficiently for recently visited, i don't want to use tree map or tree set . also, how can i store history of weeks and months. Is it written on disk when browser closes ? and when i click clear history , how is the data structure deleted ?</p>