{"componentChunkName":"component---src-templates-blog-post-jsx","path":"/blogs/priorityQueues","result":{"data":{"blog":{"frontmatter":{"title":"PRIORITY QUEUES","thumbnail":"blog37","date":"January 6, 2021","dsaCppCodeFile":"https://drive.google.com/file/d/1kHhg_G6bMCOmS0MHr2CaTju8VE5NEvpv/view?usp=sharing"},"excerpt":"<div class=\"my-2 p-2\">\n              <p>\n                In this blog post will study why to use priority queues,\n                applications, operations and C++ code file for implementation of\n                ordinary queue.\n              </p>\n            </div>\n            <div class=\"my-2 p-2\">\n              <h4>Why to use them?</h4>\n              <div class=\"m-2\">\n                <p>\n                  In special cases for example; job applications, the list of\n                  applications will be set in queue but in some cases there will\n                  be some priority given to cenrtain applicants whose\n                  application will be processed earliar irrespective of the\n                  waiting queue.\n                </p>\n                <p>\n                  So to implement this, we can either enqueue the data as they\n                  come and dequeue the data with highest/minimum priority or\n                  enqueue in order and dequeue as usually from front.\n                </p>\n                <p>\n                  In this post, we shall see the first method. We shall input\n                  the item as they come and delete the minimum value from the\n                  queue.\n                </p>\n              </div>\n            </div>\n            <div class=\"my-2 p-2\">\n              <h4>Applications</h4>\n              <ul class=\"pl-4\">\n                <li>Data compression: Huffman Coding algorithm</li>\n                <li>Shortest path algorithms: Dijkstra’s algorithm</li>\n                <li>Selection problem: Finding kth- smallest element</li>\n                <li>Event-driven simulation: customers in a line</li>\n                <li>Minimum spanning tree algorithms: Prim’s algorithm</li>\n              </ul>\n            </div>\n            <div class=\"my-2 p-2\">\n              <h4>Standard Operations</h4>\n              <ol class=\"pl-4\">\n                <li>\n                  <strong>Enqueue:</strong> Insert a new item at the rear end of\n                  the queue. If there is no place then queue is in overflow\n                  state.\n                </li>\n                <li>\n                  <strong>Dequeue:</strong> Remove an item from the front end of\n                  the queue. Find out the minimum value in the queue and remove\n                  it. If there are no elements then the queue is in underflow\n                  state.\n                </li>\n                <li>\n                  <strong>isEmpty:</strong> To check whether queue is empty or\n                  not.\n                </li>\n                <li>\n                  <strong>isFull:</strong> To check if queue is full or not.\n                </li>\n                <li>\n                  <strong>Display</strong> Display the items in the queue.\n                </li>\n              </ol>\n            </div>\n            <div class=\"my-2 p-2\">\n              <strong>Similar posts:</strong>\n              <a href=\"/blogs/queue\">Ordinary Queues</a>\n              |\n              <a href=\"/blogs/circularQueues\">Circular Queues</a>\n              |\n              <a href=\"/blogs/queueUsingLinkedLists\"\n                >Queue Using Linked Lists</a\n              >\n            </div>\n","html":"<div class=\"my-2 p-2\">\n              <p>\n                In this blog post will study why to use priority queues,\n                applications, operations and C++ code file for implementation of\n                ordinary queue.\n              </p>\n            </div>\n            <div class=\"my-2 p-2\">\n              <h4>Why to use them?</h4>\n              <div class=\"m-2\">\n                <p>\n                  In special cases for example; job applications, the list of\n                  applications will be set in queue but in some cases there will\n                  be some priority given to cenrtain applicants whose\n                  application will be processed earliar irrespective of the\n                  waiting queue.\n                </p>\n                <p>\n                  So to implement this, we can either enqueue the data as they\n                  come and dequeue the data with highest/minimum priority or\n                  enqueue in order and dequeue as usually from front.\n                </p>\n                <p>\n                  In this post, we shall see the first method. We shall input\n                  the item as they come and delete the minimum value from the\n                  queue.\n                </p>\n              </div>\n            </div>\n            <div class=\"my-2 p-2\">\n              <h4>Applications</h4>\n              <ul class=\"pl-4\">\n                <li>Data compression: Huffman Coding algorithm</li>\n                <li>Shortest path algorithms: Dijkstra’s algorithm</li>\n                <li>Selection problem: Finding kth- smallest element</li>\n                <li>Event-driven simulation: customers in a line</li>\n                <li>Minimum spanning tree algorithms: Prim’s algorithm</li>\n              </ul>\n            </div>\n            <div class=\"my-2 p-2\">\n              <h4>Standard Operations</h4>\n              <ol class=\"pl-4\">\n                <li>\n                  <strong>Enqueue:</strong> Insert a new item at the rear end of\n                  the queue. If there is no place then queue is in overflow\n                  state.\n                </li>\n                <li>\n                  <strong>Dequeue:</strong> Remove an item from the front end of\n                  the queue. Find out the minimum value in the queue and remove\n                  it. If there are no elements then the queue is in underflow\n                  state.\n                </li>\n                <li>\n                  <strong>isEmpty:</strong> To check whether queue is empty or\n                  not.\n                </li>\n                <li>\n                  <strong>isFull:</strong> To check if queue is full or not.\n                </li>\n                <li>\n                  <strong>Display</strong> Display the items in the queue.\n                </li>\n              </ol>\n            </div>\n            <div class=\"my-2 p-2\">\n              <strong>Similar posts:</strong>\n              <a href=\"/blogs/queue\">Ordinary Queues</a>\n              |\n              <a href=\"/blogs/circularQueues\">Circular Queues</a>\n              |\n              <a href=\"/blogs/queueUsingLinkedLists\"\n                >Queue Using Linked Lists</a\n              >\n            </div>"},"thumbnail":{"childImageSharp":{"fluid":{"tracedSVG":"data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='400'%20height='225'%20viewBox='0%200%20400%20225'%20preserveAspectRatio='none'%3e%3cpath%20d='M42%2091c-4%200-4%200-4%205-2%2011-1%2014%201%2014s3-1%203-3l1-3%202%203c2%203%202%204%204%201v-3c-1-2-1-4%201-6%203-6%200-9-8-8m11%200v1l-1%2010c0%208%200%208%203%208%202%200%202%200%202-3s0-3%201-1c6%2010%2017-2%2012-12-3-6-10-4-12%202-1%203-1%203-1-1s0-5-2-5l-2%201m24%200c-5%200-5%201-5%2010%200%208%200%209%202%209s2%200%202-3c0-4%202-4%204%200%201%203%201%203%203%202s2-2%201-3v-9c1-5-1-7-7-6m11-1l-1%2012-1%208h3c2%200%203-1%203-3a1962%201962%200%20002-11c2%200%202%201%202%207%200%207%200%207%203%207%202%200%202%200%202-6%200-7%201-9%203-9l2-1%202%205c2%203%203%207%202%208%200%203%200%203%202%203s3%200%203-2l3-9c3-7%203-8%200-8-1%200-3%201-3%203l-2%203-1-3c-2-4-2-4-4-3h-2l-18-1m46%201c-8%205-6%2019%203%2019%205-1%205-1%206-8%200-9-3-13-9-11m29%200c-4%200-5%202-5%2013v6h4c6%200%209-1%209-3s-1-2-4-2c-5%200-5-2%200-3%204-1%204-4%200-4-5%200-5-2%200-3%204%200%205-1%205-3s-2-2-9-1m29%200h-5v4l-1%205v-5c0-4%200-4-2-4-3%200-3%200-3%205%200%206-1%209-3%209l-1-7c1-7%201-7-1-7-3%200-4%203-4%2012s10%2010%2013%201c1-2%201-2%201%202v4h4c6%200%209-1%209-3s-1-2-4-2c-5%200-5-2%200-3%204%200%204-4%200-4s-4-2%201-3c3%200%204-1%204-2-1-3-1-3-8-2M24%2092l-1%209-1%209h2c3%200%203%200%203-3l3-3c6-2%207-6%205-11-1-2-8-3-11-1m121%202c-2%2010%200%2016%205%2016%204%200%207-3%207-12%201-7%201-7-1-7-3%200-3%201-3%207-1%205-1%207-3%207l-1-7c0-7%200-7-2-7-1%200-2%201-2%203m58-1c-3%203-2%206%201%208%204%204%204%205%200%205h-3c-2%204%207%205%2010%202s3-5-1-8l-3-5%201%201c1%202%204%202%205%200%201-5-8-7-10-3m65%209c-3%203-5%2013-3%2017%201%202%204%203%205%201%201-1-1-9-3-10-4-1%202-9%208-9%207%200%209%205%206%2011-2%205-2%208%200%209%204%201%207-8%204-9l-1-4c0-8-10-12-16-6m31%204l-1%208v7h17l-5%205a66%2066%200%2000-19%2037l-2%2010v1l6-7c7-9%2017-15%2017-10%200%202%201%203%203%203l2-2-1-3h3c3%200%202%201%200%204l-2%204v3h-17v7c0%206%200%207-2%208-3%202-3%203%200%203%202%200%203%204%201%206l-6%201c-9%200-11-4-7-9l2-5c0-3-8%206-8%2010-1%203-1%203-10%204-8%200-8%200-8%202s1%203%205%203c5%200%206%200%204%205-1%202%201%202%2048%202h49l1-4c1-2%202-3%205-3%205-1%205-4%200-5h-3v-14c0-14-1-21-4-21l-2-2-1-2c-7-1-7-4-3-12%207-13%207-17%200-22-4-3-5-4-5-8l-1-4c-1-1-1%201-1%204%200%205%200%205-2%204-3-1-19%200-23%201l-3%201v-10l-14-1-13%201m2%208v6h22v-13h-22v7m-31%2027l1%209h12v-18h-13v9m55%2016c0%201-1%202-3%202s-2%201-2%204v3h6c9%200%209%200%208%207l1%208v2l-1%203c0%204%200%204%205%204%207%201%208%200%208-5l-1-6-2-4-2-5-1-3h-1v-2l-3-5c-1-2-3-3-7-4l-5-2v3m-52%207l-1%205c0%203%200%204-1%203%200-4-2-3-3%200l2%204%202%203%203%201c2%200%202%200%202-3%200-2%200-3%202-3s2-1%202-4l-1-4-1%203c0%204-2%203-2-2-1-3-1-4-4-3'%20fill='%23d3d3d3'%20fill-rule='evenodd'/%3e%3c/svg%3e","aspectRatio":1.7699115044247788,"src":"/static/20a41bbf179e93e3f93071a3ae396d19/ee604/blog37.png","srcSet":"/static/20a41bbf179e93e3f93071a3ae396d19/69585/blog37.png 200w,\n/static/20a41bbf179e93e3f93071a3ae396d19/497c6/blog37.png 400w,\n/static/20a41bbf179e93e3f93071a3ae396d19/ee604/blog37.png 800w,\n/static/20a41bbf179e93e3f93071a3ae396d19/f3583/blog37.png 1200w,\n/static/20a41bbf179e93e3f93071a3ae396d19/e4d72/blog37.png 1280w","sizes":"(max-width: 800px) 100vw, 800px"}}}},"pageContext":{"blog":"priorityQueues","thumbnail":"thumbnails/blog37.png"}},"staticQueryHashes":["2987289216","63159454"]}