title: Datastructure with equivalent power of heap and map
body: <p>I want to design a container C of element E. </p>
  
  <p>E has 2 attributes (priority, name), All elements in container have unique 'name' </p>
  
  <p>I want to support following operations on this container C as effeciently as possible.</p>
  
  <ol>
  <li>insert:- inserts element1(name1, priority1) to the container:
  C.insert(element(name1, priority1))</li>
  <li>update :- update priority of element with name=name1 as priorityNew1:
  C[name1] = priorityNew1</li>
  <li>delete:-deletes the element with name=name1: C.delete(name1)</li>
  <li>get and remove element with highest priority: C.pop()</li>
  <li>get element with highest priority: C.peek()</li>
  </ol>
  
  <p>Basically I want a combination of map and heap. map on element's 'name', and heap on element's 'priority'.
  Most ideally I would like every operation as O(1).
  Otherwise insert, update, delete as O(log N) and pop and peek as O(1) is also fine.</p>
  
  <p>I could think of following two approaches</p>
  
  <p>1) Using a hash map of elements, hashed on name.
  so insert update delete are O(1) 
  pop and peek are O(N), we search whole container for highest priority.</p>
  
  <p>2) Using SQLite with table 'element' having two columns 'name' and 'priority'.
  running times will be based on SQLite implementations.</p>
  
  <p>I am interested to know more thoughts on this problem, I am facing a real world problem related to this.
  Thanks for your inputs.</p>