{"componentChunkName":"component---src-templates-blog-post-jsx","path":"/blogs/queue","result":{"data":{"blog":{"frontmatter":{"title":"QUEUE DATA STRUCTURES","thumbnail":"blog34","date":"January 1, 2021","dsaCppCodeFile":"https://drive.google.com/file/d/1B_cXCC8sWyPzmuovXWzaFchQsC_U-R0q/view?usp=sharing"},"excerpt":"<div class=\"my-2 p-2\">\n              <p>\n                In this blog post will study what is a queue, types,\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>Definition</h4>\n              <div class=\"m-2\">\n                <p>\n                  A queue is an ordered list in which insertions are done at one\n                  end (rear) and deletions are done at other end (front).\n                </p>\n                <p>\n                  The first element to be inserted is the first one to be\n                  deleted. Hence, it is called First in First out (FIFO).\n                </p>\n                <p>\n                  In queue, the order in which data arrives is important.\n                  Generally, a queue is a line of people or things waiting to be\n                  served in sequential order starting at the beginning of the\n                  line or sequence.\n                </p>\n              </div>\n            </div>\n            <div class=\"my-2 p-2\">\n              <h4>Types</h4>\n              <ol class=\"pl-4\">\n                <li>Ordinary Queue</li>\n                <li>Circular Queue</li>\n                <li>Priority Queue</li>\n                <li>Double Ended Queue(Not much used)</li>\n              </ol>\n              <p class=\"text-muted pl-2\">\n                <em\n                  >We will study the 2nd & 3rd type in seperate blog posts.</em\n                >\n              </p>\n            </div>\n            <div class=\"my-2 p-2\">\n              <h4>Applications</h4>\n              <ul class=\"pl-4\">\n                <li>\n                  Operating systems schedule jobs (with equal priority) in the\n                  order of arrival (e.g., printing a document).\n                </li>\n                <li>\n                  Simulation of real-world queues such as lines at a ticket\n                  counter or any other firstcome first-served scenario requires\n                  a queue.\n                </li>\n                <li>Asynchronous data transfer (file IO, pipes, sockets).</li>\n                <li>Used as component for other data structures.</li>\n                <li>Waiting times of customers at call center.</li>\n              </ul>\n            </div>\n            <div class=\"my-2 p-2\">\n              <h4>Standard Operations</h4>\n              <p class=\"text-muted\">\n                Do refer the code available the end of this section to\n                understand the following theory.\n              </p>\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. If there are no elements then the queue is in\n                  underflow 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/circularQueues\">Circular Queues</a>\n                |\n              <a href=\"/blogs/priorityQueues\">Priority 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 what is a queue, types,\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>Definition</h4>\n              <div class=\"m-2\">\n                <p>\n                  A queue is an ordered list in which insertions are done at one\n                  end (rear) and deletions are done at other end (front).\n                </p>\n                <p>\n                  The first element to be inserted is the first one to be\n                  deleted. Hence, it is called First in First out (FIFO).\n                </p>\n                <p>\n                  In queue, the order in which data arrives is important.\n                  Generally, a queue is a line of people or things waiting to be\n                  served in sequential order starting at the beginning of the\n                  line or sequence.\n                </p>\n              </div>\n            </div>\n            <div class=\"my-2 p-2\">\n              <h4>Types</h4>\n              <ol class=\"pl-4\">\n                <li>Ordinary Queue</li>\n                <li>Circular Queue</li>\n                <li>Priority Queue</li>\n                <li>Double Ended Queue(Not much used)</li>\n              </ol>\n              <p class=\"text-muted pl-2\">\n                <em\n                  >We will study the 2nd & 3rd type in seperate blog posts.</em\n                >\n              </p>\n            </div>\n            <div class=\"my-2 p-2\">\n              <h4>Applications</h4>\n              <ul class=\"pl-4\">\n                <li>\n                  Operating systems schedule jobs (with equal priority) in the\n                  order of arrival (e.g., printing a document).\n                </li>\n                <li>\n                  Simulation of real-world queues such as lines at a ticket\n                  counter or any other firstcome first-served scenario requires\n                  a queue.\n                </li>\n                <li>Asynchronous data transfer (file IO, pipes, sockets).</li>\n                <li>Used as component for other data structures.</li>\n                <li>Waiting times of customers at call center.</li>\n              </ul>\n            </div>\n            <div class=\"my-2 p-2\">\n              <h4>Standard Operations</h4>\n              <p class=\"text-muted\">\n                Do refer the code available the end of this section to\n                understand the following theory.\n              </p>\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. If there are no elements then the queue is in\n                  underflow 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/circularQueues\">Circular Queues</a>\n                |\n              <a href=\"/blogs/priorityQueues\">Priority 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='M27%2091c-5%202-6%2014-2%2017%202%202%2010%202%2010%201%202-4%201-15-1-16-2-2-4-3-7-2m30%200h-5v5l-1%209v5h5c6%200%208-1%208-3s-1-2-3-2l-4-1c-1-1%201-2%204-2l2-2c0-2-1-2-3-2-4%200-4-2%201-3%203%200%204-1%204-3l-2-2-6%201m28%200l-4%201-1%209v9h4c6%200%209-1%209-3s-1-2-4-2c-5%200-5-2-1-3%204%200%204-4%200-4s-4-2%201-3c3%200%204-1%204-3s0-2-8-1m-48%207c0%208%201%2012%206%2012s7-3%208-11v-8h-2c-3%200-3%200-3%205%200%207-1%209-3%209l-1-7c1-7%201-7-1-7-3%200-3%200-4%207m29%200c-1%208%200%2011%205%2012%205%200%207-3%208-11%200-8%200-8-2-8-3%200-3%200-3%207%200%205-1%207-2%207l-1-7c0-7%200-7-2-7-3%200-3%200-3%207m202%204c-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%203s3-1%201-2l-1-3h4c3%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%204l-23%201-3%201v-10l-14-1-13%201m2%208v6h22v-13h-22v7M24%20124l-1%2010v9l3-1c5%200%207-2%208-5%202-4%202-9%200-12-1-2-7-3-10-1m18%202l-4%209-2%207h3l3-1c1-2%205-3%205-1s4%203%205%202l-3-17c-1-3-6-3-7%201m11%200c0%203%200%203%202%203%202-1%202-1%202%206s0%207%203%207c2%200%202%200%202-7%200-6%200-7%203-7l2-3c0-2-1-2-7-2h-7v3m20%200c-2%202-6%2015-6%2016h3l3-1c0-3%204-2%204%200%201%202%204%202%205%201s-2-16-3-18c-2-2-5-1-6%202m21%200c-3%203-3%205%202%209l4%203h-4c-3%200-3%200-3%202%200%203%208%203%2010%200s1-6-2-8l-3-4h1c1%202%205%203%205%201l3-1c2%200%202%200%202%207s0%207%202%207%203-1%203-2c0-11%200-12%202-12l2-3c0-2-1-2-6-2-6%200-7%200-7%202h-2c-3-3-7-2-9%201m27-2l-2%209v9h2c2%200%203-1%203-3l1-3%201%203c2%203%203%203%205%202v-3c-1-3-1-4%201-6v-6c-2-3-8-4-11-2m14%201v15c1%203%208%203%2010%200%203-4%203-17%200-17-2%200-3%203-3%2010%200%204-1%206-3%205v-8c0-6%200-7-2-7l-2%202m16%200c-3%204-4%2011-2%2014%203%204%208%204%2011%200%202-3%200-5-3-2s-5-1-3-7c1-3%204-4%203-1-1%202%200%202%202%202l3-1c0-1%201-2%203-2s2%200%202%207%200%207%203%207l2-1v-7c0-5%200-6%202-6l2-3c0-2-1-2-6-2-7%200-7%200-7%202v2l-2-2c-3-3-7-3-10%200m27%201v15l5%201c5%200%207-3%207-11%200-7%200-8-2-8-1%200-2%201-3%207-1%209-2%209-3%200%200-6%200-7-2-7-1%200-2%201-2%203m15-2l-2%209v9h2c2%200%203-1%203-3l1-3%201%203c2%203%203%203%205%202v-3c-1-2-1-4%201-6%201-3%201-5-1-7-1-2-8-3-10-1m14%201l-1%2010v7h7c6%200%206%200%206-2%200-3%200-3-4-3-5%200-5-2-1-2%204-1%204-5%200-5l-3-1%204-1c3%200%204%200%204-2%201-3%200-3-6-3-5%200-6%200-6%202m63%2016l1%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%2010-1%207-7v-5l-1-3-3-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/ac875d20696c7bf4098b8fd413d0ee62/ee604/blog34.png","srcSet":"/static/ac875d20696c7bf4098b8fd413d0ee62/69585/blog34.png 200w,\n/static/ac875d20696c7bf4098b8fd413d0ee62/497c6/blog34.png 400w,\n/static/ac875d20696c7bf4098b8fd413d0ee62/ee604/blog34.png 800w,\n/static/ac875d20696c7bf4098b8fd413d0ee62/f3583/blog34.png 1200w,\n/static/ac875d20696c7bf4098b8fd413d0ee62/e4d72/blog34.png 1280w","sizes":"(max-width: 800px) 100vw, 800px"}}}},"pageContext":{"blog":"queue","thumbnail":"thumbnails/blog34.png"}},"staticQueryHashes":["2987289216","63159454"]}