title: Time expiration data structure
body: <p>On a recent coding interview I was asked to implement a key - value store data structure.
  implement</p>
  
  <p>size() : Number of elements in the list.</p>
  
  <p>find(key) : Return the value at the key, otherwise throw nosuchelement exception. </p>
  
  <p>insert(key, timestamp) : Add or update the element with this key. If the list is full, then don't do anything. </p>
  
  <ul>
  <li>The list has a maximum number of elements that it can hold</li>
  <li>Every element is inserted as a key and a value, time duration after which it should not be considered as in the list, and the time stamp of the time it was entered. </li>
  <li>If the list is full, then ignore the element trying to be added, unless it is a duplicate key. </li>
  <li>If the element with the same key already exists, update the existing value and the existing time stamp</li>
  <li>Once the time exceeds the time stamp + duration of an element, then don't consider it to be part of the structure any more. This means that if the list was previously full, It is not full any more. </li>
  </ul>
  
  <p>I was having trouble finding an efficient way to keep track of the elements that are still in the list considering that elements can be ejected from the list if their time has run out. </p>