title: All purpose of binary heap
body: <blockquote>
  <h1>Definition:</h1>
  <p>A <strong>priority queue</strong> is an abstract data type which is like a regular queue or stack data structure, but where additionally each element has a &quot;priority&quot; associated with it. In a priority queue, an element with high priority is served before an element with low priority. If two elements have the same priority, they are served according to their order in the queue.</p>
  <h1>Implementation:</h1>
  <p>To implement <strong>Priority queue</strong>, <em>unsorted array</em>, <em>sorted array</em> and <em>binary heap</em> data structure are the 3 implementation strategies .</p>
  <p>To be specific, <em>binary heap</em> implementation strategy can be represented using <em>array</em> of keys,</p>
  <p><a href="https://i.stack.imgur.com/dT33q.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dT33q.png" alt="enter image description here" /></a></p>
  <p>or</p>
  <p>each <em>key</em> as <em>binary node</em> having two children.</p>
  <p><a href="https://i.stack.imgur.com/BVtQd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BVtQd.png" alt="enter image description here" /></a></p>
  </blockquote>
  <hr />
  <p>Question:</p>
  <p>Apart from priority queue implementation, Are their any other applications of using <em>binary heap</em> data structure?</p>