{"id":67120,"date":"2022-05-05T10:45:59","date_gmt":"2022-05-05T05:15:59","guid":{"rendered":"https:\/\/www.mygreatlearning.com\/blog\/python-queue\/"},"modified":"2024-10-14T23:55:47","modified_gmt":"2024-10-14T18:25:47","slug":"python-queue","status":"publish","type":"post","link":"https:\/\/www.mygreatlearning.com\/blog\/python-queue\/","title":{"rendered":"Python Queue"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\" id=\"introduction\"><strong>Introduction<\/strong><\/h2>\n\n\n\n<p>A queue is a type of <a href=\"https:\/\/www.mygreatlearning.com\/blog\/data-structures-using-java\/\" target=\"_blank\" rel=\"noreferrer noopener\">data structure<\/a> that holds data in a First in First Out manner. Queue follows a specific order for the operations to be performed on the data. The queue is widely implemented as a waiting list for single shared resources or devices such as Printers, CPU, Disk, etc. There are different types of queues like a simple queue, <a href=\"https:\/\/www.mygreatlearning.com\/blog\/priority-queue-in-cpp\/\" target=\"_blank\" rel=\"noreferrer noopener\">priority queue<\/a>, circular queue, and deque or double-ended queue. All these types of queues are used for different scenarios. Queues are very useful for example, if we need a process to be executed one after other automatically in an order i.e. just like a list. It will process the tasks in a manner called \u201cFirst In First Out\u201d which means the first process or task in the queue will be executed and removed first, after that other processes will be started. A queue can be implemented in programming languages such as <a href=\"https:\/\/www.mygreatlearning.com\/blog\/python-tutorial-for-beginners-a-complete-guide\/\" target=\"_blank\" rel=\"noreferrer noopener\">Python<\/a>, Java, <a href=\"https:\/\/www.mygreatlearning.com\/blog\/cpp-tutorial\/\" target=\"_blank\" rel=\"noreferrer noopener\">C++<\/a>, etc. Here are going to discuss its implementation in Python Programming Language.<\/p>\n\n\n\n    <div class=\"courses-cta-container\">\n        <div class=\"courses-cta-card\">\n            <div class=\"courses-cta-header\">\n                <div class=\"courses-learn-icon\"><\/div>\n                <span class=\"courses-learn-text\">Academy Pro<\/span>\n            <\/div>\n            <p class=\"courses-cta-title\">\n                <a href=\"https:\/\/www.mygreatlearning.com\/academy\/premium\/master-python-programming\" class=\"courses-cta-title-link\">Python Programming Course<\/a>\n            <\/p>\n            <p class=\"courses-cta-description\">In this course, you will learn the fundamentals of Python: from basic syntax to mastering data structures, loops, and functions. You will also explore OOP concepts and objects to build robust programs.<\/p>\n            <div class=\"courses-cta-stats\">\n                <div class=\"courses-stat-item\">\n                    <div class=\"courses-stat-icon courses-user-icon\"><\/div>\n                    <span>11.5 Hrs<\/span>\n                <\/div>\n                <div class=\"courses-stat-item\">\n                    <div class=\"courses-stat-icon courses-star-icon\"><\/div>\n                    <span>51 Coding Exercises<\/span>\n                <\/div>\n            <\/div>\n            <a href=\"https:\/\/www.mygreatlearning.com\/academy\/premium\/master-python-programming\" class=\"courses-cta-button\">\n                Start Free Trial\n                <div class=\"courses-arrow-icon\"><\/div>\n            <\/a>\n        <\/div>\n    <\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"what-is-a-queue-in-python\"><strong>What is a Queue in Python?<\/strong><\/h2>\n\n\n\n<p>As we just discussed what is a queue. It is the same in Python and works on the same methodology \u201cFirst in First Out\u201d (FIFO). A queue has two ends such as the front end and rear end. The items that can be inserted from is the rear end and the items that are removed from the queue are from the Front end. Therefore, the item that is inserted first in the queue will be the first item that will be removed from the queue and it satisfies the FIFO methodology.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"how-does-python-queue-work\"><strong>How does Python Queue work?<\/strong><\/h2>\n\n\n\n<p>Python queue can be easily implemented to work with real-world problems. For better understanding, it can be compared with a line of people waiting for their number to purchase tickets from the ticket counter. The first person who entered the line will get the tickets first and after that, he will be removed from the line, followed by the next person in the lane and so on. A similar logic will be applied in Python Queue too for programs and processes to be executed.&nbsp;<\/p>\n\n\n\n<p>Let us see the below diagram to better understand the ends of the Queue:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>1<\/td><td>2<\/td><td>3<\/td><td>4<\/td><td>5<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>In the above queue, the first element 1 is representing the Front end of the queue and the last element 5 is representing the end of the queue that will be processed at last. The insertion will take place after the last element i.e. 5 and the removal of elements will take place from the start of the list i.e. 1.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"types-of-the-queue-in-python\"><strong>Types of the queue in Python<\/strong><\/h2>\n\n\n\n<p>As we just discussed in the introduction that there are 4 types of the queue in the data structure. But, In Python, there are mainly two types of queues that are discussed below:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>FIFO Queue: FIFO stands for \u201cFirst In First Out\u201d which means the element that will be inserted first is the element to come out first. While working with FIFO Queue in python, we need to call Queue() class from the queue module.&nbsp;<\/li>\n\n\n\n<li>LIFO Queue: LIFO stands for \u201cLast In First Out\u201d which means that the element that is to be inserted at the last is the element to come out first. It is just like a stack, where the top element will be treated first. While working with LIFO Queue, we need to call LifoQueue() class from the queue module in Python.&nbsp;<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"operations-in-python\"><strong>Operations in Python<\/strong><\/h2>\n\n\n\n<p>The operations available in Python are described as follows:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Front<\/strong>: The operation gives the first element from the queue where the<a href=\"https:\/\/www.mygreatlearning.com\/blog\/why-is-time-complexity-essential\/\" target=\"_blank\" rel=\"noreferrer noopener\"> Time Complexity<\/a> for this operation is O(1).<\/li>\n\n\n\n<li><strong>Rear<\/strong>: The operation gives the last element from the queue where the Time Complexity for this operation is O(1).<\/li>\n\n\n\n<li><strong>Enqueue<\/strong>: In this operation, an element is added at the end of the queue. When there is no capacity for elements to be added to the queue, it goes to a condition of overflow and the Time complexity for this operation is also O(1).<\/li>\n\n\n\n<li><strong>Dequeue<\/strong>: In this type of operation, we can delete the element from any end of the queue such as front or rear. Also, the insertion of elements takes place at both ends. The time complexity for this operation is the same as other operations i.e. O(1).<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"methods-available-in-the-queue\"><strong>Methods available in the queue<\/strong><\/h2>\n\n\n\n<p>There are some important methods available in Python which are very useful. These methods are listed below:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>get<\/strong>(): This method is used to remove and return an element from the queue. When there is no element in the queue, it waits for the element to be available in the queue.&nbsp;<\/li>\n\n\n\n<li><strong>put<\/strong>(): This method is used to add an element in the queue which can be represented as an instance of Queue. If there is no capacity for more elements to be added to the queue, then the method will block.&nbsp;<\/li>\n\n\n\n<li><strong>qsize<\/strong>: The qsize() method in the queue class of Python returns the total number of elements present in the queue. Or we can say that it tells us the length of the queue.&nbsp;<\/li>\n\n\n\n<li>full(): This method is used to check if the queue is full and it returns True if the queue is full.<\/li>\n\n\n\n<li><strong>maxsize<\/strong>(): This method is an integer that tells the upper bound limit of the number of elements that can be entered in the queue. The insertion of the elements will be blocked once it reaches the maxsize of the elements to be inserted.&nbsp;<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"built-in-python-list\"><strong>Built-in Python List<\/strong><\/h2>\n\n\n\n<p>The built-in list of methods in Python can be used as the queue, but the use of these built-in methods as the queue is not well suited when we see it from the view of performance. The built-in methods in Python are the insert() and pop() functions that are used to add and remove elements from the queue. Lists are a little slow as compared with queues and the reason behind this is when we insert a new element to the list, it requires the shifting of elements by one. And this process takes O(n) time. To better understand this concept, go through the example below:<\/p>\n\n\n\n<p><strong>Example:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>que = &#091;]\nque.append(\u2018Person1\u2019)\nque.append(\u2018Person2\u2019)\nque.append(\u2018Person3\u2019)\n\nprint(que)\n\n#List is quite slow because of the shifting of elements by one place.\nprint(que.pop(0))\n<\/code><\/pre>\n\n\n\n<p><strong>OUTPUT:<\/strong><\/p>\n\n\n\n<p>[\u2018Person1\u2019, \u2018Person2\u2019, \u2018Person3\u2019]<\/p>\n\n\n\n<p>Person1<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>class Queue:\n\ndef __init__(self):\n\tself.queue = list()\n\ndef add_elements(self, val):\n\tif val not in self.queue:\n\t\tself.queue.insert(0, val)\n\t\treturn True\n\treturn False\n\ndef size(self):\n\treturn len(self.queue)\n\nOurQueue = Queue()\nOurQueue.add_element(\u201cPerson1\u201d)\nOurQueue.add_element(\u201cPerson2\u201d)\nOurQueue.add_element(\u201cPerson3\u201d)\nOurQueue.add_element(\u201cPerson4\u201d)\n\nprint(\u201cLength of the Queue: \u201c, OurQueue.size())\n\n<\/code><\/pre>\n\n\n\n<p><strong>OUTPUT:<\/strong><\/p>\n\n\n\n<p>Length of the Queue: 4<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"removing-elements-from-a-queue\"><strong>Removing elements from a queue<\/strong><\/h2>\n\n\n\n<p>The removal of elements from a queue takes place from the Rear end of the queue. The process of removing an element from a queue is also called deque. Let us see the following example to understand this concept more clearly:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>class Queue:  \n  \n  def __init__(self):  \n      self.queue = list()  \n  \n  def add_element(self,val):  \n# Insert method to add element in the queue\n      if val not in self.queue:  \n          self.queue.insert(0,val)  \n          return True  \n      return False  \n# Pop method to delete element from the queue\n  def remove_element(self):  \n      if len(self.queue)&gt;0:  \n          return self.queue.pop()  \n      return (\"Queue is Empty\")  \n  \nque = Queue()  \nque.add_element(\"January\")  \nque.add_element(\"February\")  \nque.add_element(\"March\")  \nque.add_element(\"April\")  \n  \nprint(que)  \nprint(que.remove_element())  \nprint(que.remove_element()) \n<\/code><\/pre>\n\n\n\n<p><strong>OUTPUT:<\/strong><\/p>\n\n\n\n<p>January<\/p>\n\n\n\n<p>February<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"sorting-a-python-queue\"><strong>Sorting a Python queue<\/strong><\/h2>\n\n\n\n<p>Sorting a queue becomes important in some scenarios where we need to perform specific operations. It can be done in Python by various methods. Here is an example below to better understand the sorting of queue:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import queue  \nq = queue.Queue()  \n  \nq.put(10)  \nq.put(22)  \nq.put(16)  \nq.put(2)  \nq.put(1)  \n  \n  \n# Here, we use bubble sort algorithm for sorting  \nn =  q.qsize()  \nfor i in range(n):  \n    # Remove the element  \n    x = q.get()  \n    for j in range(n-1):  \n        # Remove the element  \n        y = q.get()  \n        if x &gt; y :  \n            q.put(y)  \n        else:  \n            q.put(x)  \n            x = y      \n    q.put(x)  \n  \nwhile (q.empty() == False):   \n    print(q.queue&#091;0], end = \" \")    \n    q.get()  \n<\/code><\/pre>\n\n\n\n<p><strong>OUTPUT:<\/strong><\/p>\n\n\n\n<p>1 2 10 16 22&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"reversing-a-python-queue\"><strong>Reversing a Python queue<\/strong><\/h2>\n\n\n\n<p>The queue can be reversed to make use of another queue. It can also be implemented for recursion.<\/p>\n\n\n\n<p>The example below can be understood to know how we can reverse a Python queue:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import queue\nq1 = queue.Queue()\n\nq1.put(10)\nq1.put(4)\nq1.put(3)\nq1.put(20)\nq1.put(2)\nq1.put(9)\n\ndef reverseQueue (q1src, q2dest) :  \n    buffer = q1src.get()\n    if (q1src.empty() == False) :\nreverseQueue(q1src, q2dest)      #using recursion\n    q2dest.put(buffer)\nreturn q2dest\n\nq2dest = queue.Queue()\nqReversed = reverseQueue(q1,q2dest)\n\nwhile (qReversed.empty() == False): \nprint(qReversed.queue&#091;0], end = \" \")  \n        qReversed.get()\n<\/code><\/pre>\n\n\n\n<p><strong>OUTPUT:<\/strong><\/p>\n\n\n\n<p>9 2 20 3 4 10<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"working-with-a-queue-queue-class\"><strong>Working with a queue.queue class<\/strong><\/h2>\n\n\n\n<p>Various classes come in the Queue module of Python. Out of all the classes, the Queue class is more important that helps in parallel computing and multiprogramming. This concept can be understood very easily by the following example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>from queue import Queue  \nque = Queue()  \n  \nque.put('Person1\u2019)  \nque.put('Person2')  \nque.put('Person3')  \n  \nprint(que)  \n  \n  \nprint(que.get())  \n  \nprint(que.get())  \n  \nprint(que.get())  \n  \nprint(que.get_nowait())  \n  \nprint(que.get())  \n<\/code><\/pre>\n\n\n\n<p><strong>OUTPUT:<\/strong><strong><br><\/strong>&lt;queue.Queue object at 0x00000114B30656A0&gt;<\/p>\n\n\n\n<p>Person1<\/p>\n\n\n\n<p>Person2<\/p>\n\n\n\n<p>Person3<\/p>\n\n\n\n<p>Traceback (most recent call last):<\/p>\n\n\n\n<p>&nbsp;&nbsp;File \"C:\/Users\/Ashu Lakhwan\/PycharmProjects\/Hello\/Queue.py\", line 78, in &lt;module&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;print(que.get_nowait())<\/p>\n\n\n\n<p>&nbsp;&nbsp;File \"C:Pythonlibqueue.py\", line 198, in get_nowait<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;return self.get(block=False)<\/p>\n\n\n\n<p>&nbsp;&nbsp;File \"C:Pythonlibqueue.py\", line 167, in get<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;raise Empty<\/p>\n\n\n\n<p>_queue.Empty<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"working-with-a-collection-deque-class\"><strong>Working with a collection.deque Class<\/strong><\/h2>\n\n\n\n<p><strong><br><\/strong>The collection. deque class becomes very useful when we are implementing a double-ended queue. The double-ended queue or deque is used to support the insertion and deletion of elements from both the ends such as the Front and Rear ends. The time complexity it takes is O(1) to complete the process.&nbsp;<\/p>\n\n\n\n<p>The example of collection. deque class is as follows:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>from collections import deque  \nqueue = deque()  \n  \nqueue.append('Monday')  \nqueue.append('Tuesday')  \nqueue.append('Wednesday')  \n  \nprint(queue)  \ndeque(&#091;'Monday ', 'Tuesday', 'Wednesday'])  \n  \nprint(queue.popleft())  \n  \nprint(queue.popleft())  \n  \nprint(queue.popleft())  \n\nqueue.popleft()  \n\n<\/code><\/pre>\n\n\n\n<p><strong>OUTPUT:<\/strong><strong><br><\/strong><\/p>\n\n\n\n<p>deque(['Monday', 'Tuesday', 'Wednesday'])<\/p>\n\n\n\n<p>Monday&nbsp;<\/p>\n\n\n\n<p>Tuesday&nbsp;<\/p>\n\n\n\n<p>Wednesday&nbsp;<\/p>\n\n\n\n<p>Traceback (most recent call last):<\/p>\n\n\n\n<p>&nbsp;&nbsp;File \"C:\/Users\/Ashu Lakhwan\/PycharmProjects\/Hello\/Queue.py\", line 101, in &lt;module&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;que.popleft()<\/p>\n\n\n\n<p>IndexError: pop from an empty deque<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"working-with-a-multiprocessing-queue-class\"><strong>Working with a multiprocessing.Queue Class<\/strong><\/h2>\n\n\n\n<p>This class can be used to process queued items parallelly by multicurrent workers. The multiprocessing. Queue Class shares the data between multiple processes and stores the information of any object that can be picked while processing items.&nbsp;<\/p>\n\n\n\n<p><strong>Example:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>from multiprocessing import Queue  \nqueue = Queue()  \n  \nqueue.put('Monday')  \nqueue.put('Tuesday')  \nqueue.put('Wednesday')  \n  \nprint(queue)  \n  \nprint(queue.get())  \n  \nprint(queue.get())  \n  \nprint(queue.get())\n<\/code><\/pre>\n\n\n\n<p><strong>OUTPUT:<\/strong><\/p>\n\n\n\n<p>&lt;multiprocessing.queues.Queue object at 0x000002CA073356A0&gt;<\/p>\n\n\n\n<p>Monday<\/p>\n\n\n\n<p>Tuesday<\/p>\n\n\n\n<p>Wednesday<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"implementation-of-python-queue\"><strong>Implementation of Python queue<\/strong><\/h2>\n\n\n\n<p>There are several ways to implement a Queue to Python. However, some commonly used methods for implementing queues in python include the following:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>list<\/li>\n\n\n\n<li>collections.deque<\/li>\n\n\n\n<li>collections.Queue<\/li>\n<\/ul>\n\n\n\n<p>These methods are discussed above in this article with each topic having a separate example. You may refer to the previous section to understand the different ways of implementing Python Queue.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"how-to-add-more-than-one-element-in-python\"><strong>How to add more than one element in Python?&nbsp;<\/strong><\/h2>\n\n\n\n<p>In this article, we have seen how we can add a single item or element to our queue. Now, let us see how we can add more than one element in Python:<\/p>\n\n\n\n<p>Adding an item in FIFOqueue:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import queue\nque = queue.Queue()\n \nfor i in range(5):\n\tque.put(i)\n \nwhile not que.empty():\nprint(\u201cThe value inserted is \u201d, que)\n<\/code><\/pre>\n\n\n\n<p><strong>OUTPUT:<\/strong><\/p>\n\n\n\n<p>The value inserted is 0<\/p>\n\n\n\n<p>The value inserted is 1<\/p>\n\n\n\n<p>The value inserted is 2<\/p>\n\n\n\n<p>The value inserted is 3<\/p>\n\n\n\n<p>The value inserted is 4<\/p>\n\n\n\n<p>In the above example, the put() method will put the elements from 0 to 5 to the queue.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"first-in-first-out-queue-example\"><strong>First In First Out Queue Example<\/strong><\/h2>\n\n\n\n<p>FIFO means the element that is inserted first will be the first element to be removed from the list. To implement the FIFO queue, we are required to import the queue() module in Python.&nbsp;<\/p>\n\n\n\n<p>Let us see an example of implementing FIFO queue to add an item:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Import queue\nque = queue.Queue()\nque.put(10)\n \nThe put() method in the above example will add an element to the queue.\n \nTo remove an element from our Queue, the following example can be understood:\n \nImport queue\nque = queue.Queue()\nque.put(10)\n \nremoved_item = que.get()\n \nprint(\u201cThe removed element from the queue is \u201d, removed_item)\n<\/code><\/pre>\n\n\n\n<p><strong>OUTPUT:<\/strong><\/p>\n\n\n\n<p>The removed element from the queue is 10<\/p>\n\n\n\n<p>In the above example, the get() method is used to remove the element from the queue.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"last-in-first-out-queue-example\"><strong>Last In First Out queue Example<\/strong><\/h2>\n\n\n\n<p>LIFO means the element that is entered at the last will be the first element to be popped out or deleted. To implement, LIFO, we are required to import the queue module and use LifoQueue() method in Python.<\/p>\n\n\n\n<p>Let us understand how we can implement the adding of an element in the LIFO queue:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Import queue\nque = queue.LifoQueue()\nque.put(5)\n \nThe put() method adds an element to the LIFO queue.\n \nRemoving an element from the LIFO queue:\n \nImport queue\nque = queue.LifoQueue()\nque.put(5)\n \nremove_item = que.get()\n \nprint(\u201cThe removed item is \u201d, remove_item)\n<\/code><\/pre>\n\n\n\n<p><strong>OUTPUT:<\/strong><\/p>\n\n\n\n<p>The removed item is 5<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"conclusion\"><strong>Conclusion&nbsp;<\/strong><\/h2>\n\n\n\n<p>In this article, we discussed some useful and important concepts of Python Queue and we also looked at how they can be implemented in examples. Python Queue is very similar to standard <a href=\"https:\/\/www.mygreatlearning.com\/academy\/learn-for-free\/courses\/python-list\" target=\"_blank\" rel=\"noreferrer noopener\">List in Python<\/a>, but it is considered as always better from the performance point of view.&nbsp;<\/p>\n\n\n\n<p>Embarking on a journey towards a career in data science opens up a world of limitless possibilities. Whether you\u2019re an aspiring data scientist or someone intrigued by the power of data, understanding the key factors that contribute to success in this field is crucial. The below path will guide you to become a proficient data scientist.<\/p>\n\n\n\n<figure class=\"wp-block-table aligncenter\"><table class=\"has-cyan-bluish-gray-background-color has-background\"><tbody><tr><td><a href=\"https:\/\/www.mygreatlearning.com\/data-science\/courses\/certificates\" target=\"_blank\" rel=\"noreferrer noopener\">Data Science Course Certificates<\/a><\/td><\/tr><tr><td><a href=\"https:\/\/www.mygreatlearning.com\/data-science\/courses\/placements\" target=\"_blank\" rel=\"noreferrer noopener\">Data Science Course Placements<\/a><\/td><\/tr><tr><td><a href=\"https:\/\/www.mygreatlearning.com\/data-science\/courses\/syllabus\" target=\"_blank\" rel=\"noreferrer noopener\">Data Science Course Syllabus<\/a><\/td><\/tr><tr><td><a href=\"https:\/\/www.mygreatlearning.com\/data-science\/courses\/eligibility\" target=\"_blank\" rel=\"noreferrer noopener\">Data Science Course Eligibility<\/a><\/td><\/tr><\/tbody><\/table><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Introduction A queue is a type of data structure that holds data in a First in First Out manner. Queue follows a specific order for the operations to be performed on the data. The queue is widely implemented as a waiting list for single shared resources or devices such as Printers, CPU, Disk, etc. There [&hellip;]<\/p>\n","protected":false},"author":41,"featured_media":63040,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_uag_custom_page_level_css":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[25860],"tags":[36796],"content_type":[],"class_list":["post-67120","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-software","tag-python"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.3 (Yoast SEO v27.3) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Python Queue<\/title>\n<meta name=\"description\" content=\"Python Queue : A queue can be implemented in programming languages such as Python, Java, C++, etc.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.mygreatlearning.com\/blog\/python-queue\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python Queue\" \/>\n<meta property=\"og:description\" content=\"Python Queue : A queue can be implemented in programming languages such as Python, Java, C++, etc.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.mygreatlearning.com\/blog\/python-queue\/\" \/>\n<meta property=\"og:site_name\" content=\"Great Learning Blog: Free Resources what Matters to shape your Career!\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/GreatLearningOfficial\/\" \/>\n<meta property=\"article:published_time\" content=\"2022-05-05T05:15:59+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-10-14T18:25:47+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/03\/Python-Language.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"2000\" \/>\n\t<meta property=\"og:image:height\" content=\"1126\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Great Learning Editorial Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/Great_Learning\" \/>\n<meta name=\"twitter:site\" content=\"@Great_Learning\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Great Learning Editorial Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/python-queue\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/python-queue\\\/\"},\"author\":{\"name\":\"Great Learning Editorial Team\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#\\\/schema\\\/person\\\/6f993d1be4c584a335951e836f2656ad\"},\"headline\":\"Python Queue\",\"datePublished\":\"2022-05-05T05:15:59+00:00\",\"dateModified\":\"2024-10-14T18:25:47+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/python-queue\\\/\"},\"wordCount\":1874,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/python-queue\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/03\\\/Python-Language.jpg\",\"keywords\":[\"python\"],\"articleSection\":[\"IT\\\/Software Development\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/python-queue\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/python-queue\\\/\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/python-queue\\\/\",\"name\":\"Python Queue\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/python-queue\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/python-queue\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/03\\\/Python-Language.jpg\",\"datePublished\":\"2022-05-05T05:15:59+00:00\",\"dateModified\":\"2024-10-14T18:25:47+00:00\",\"description\":\"Python Queue : A queue can be implemented in programming languages such as Python, Java, C++, etc.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/python-queue\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/python-queue\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/python-queue\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/03\\\/Python-Language.jpg\",\"contentUrl\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/03\\\/Python-Language.jpg\",\"width\":2000,\"height\":1126,\"caption\":\"Python Language\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/python-queue\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Blog\",\"item\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"IT\\\/Software Development\",\"item\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/software\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Python Queue\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/\",\"name\":\"Great Learning Blog\",\"description\":\"Learn, Upskill &amp; Career Development Guide and Resources\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#organization\"},\"alternateName\":\"Great Learning\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#organization\",\"name\":\"Great Learning\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/GL-Logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/GL-Logo.jpg\",\"width\":900,\"height\":900,\"caption\":\"Great Learning\"},\"image\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/GreatLearningOfficial\\\/\",\"https:\\\/\\\/x.com\\\/Great_Learning\",\"https:\\\/\\\/www.instagram.com\\\/greatlearningofficial\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/school\\\/great-learning\\\/\",\"https:\\\/\\\/in.pinterest.com\\\/greatlearning12\\\/\",\"https:\\\/\\\/www.youtube.com\\\/user\\\/beaconelearning\\\/\"],\"description\":\"Great Learning is a leading global ed-tech company for professional training and higher education. It offers comprehensive, industry-relevant, hands-on learning programs across various business, technology, and interdisciplinary domains driving the digital economy. These programs are developed and offered in collaboration with the world's foremost academic institutions.\",\"email\":\"info@mygreatlearning.com\",\"legalName\":\"Great Learning Education Services Pvt. Ltd\",\"foundingDate\":\"2013-11-29\",\"numberOfEmployees\":{\"@type\":\"QuantitativeValue\",\"minValue\":\"1001\",\"maxValue\":\"5000\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#\\\/schema\\\/person\\\/6f993d1be4c584a335951e836f2656ad\",\"name\":\"Great Learning Editorial Team\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/02\\\/unnamed.webp\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/02\\\/unnamed.webp\",\"contentUrl\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/02\\\/unnamed.webp\",\"caption\":\"Great Learning Editorial Team\"},\"description\":\"The Great Learning Editorial Staff includes a dynamic team of subject matter experts, instructors, and education professionals who combine their deep industry knowledge with innovative teaching methods. Their mission is to provide learners with the skills and insights needed to excel in their careers, whether through upskilling, reskilling, or transitioning into new fields.\",\"sameAs\":[\"https:\\\/\\\/www.mygreatlearning.com\\\/\",\"https:\\\/\\\/in.linkedin.com\\\/school\\\/great-learning\\\/\",\"https:\\\/\\\/x.com\\\/https:\\\/\\\/twitter.com\\\/Great_Learning\",\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UCObs0kLIrDjX2LLSybqNaEA\"],\"award\":[\"Best EdTech Company of the Year 2024\",\"Education Economictimes Outstanding Education\\\/Edtech Solution Provider of the Year 2024\",\"Leading E-learning Platform 2024\"],\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/author\\\/greatlearning\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Python Queue","description":"Python Queue : A queue can be implemented in programming languages such as Python, Java, C++, etc.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.mygreatlearning.com\/blog\/python-queue\/","og_locale":"en_US","og_type":"article","og_title":"Python Queue","og_description":"Python Queue : A queue can be implemented in programming languages such as Python, Java, C++, etc.","og_url":"https:\/\/www.mygreatlearning.com\/blog\/python-queue\/","og_site_name":"Great Learning Blog: Free Resources what Matters to shape your Career!","article_publisher":"https:\/\/www.facebook.com\/GreatLearningOfficial\/","article_published_time":"2022-05-05T05:15:59+00:00","article_modified_time":"2024-10-14T18:25:47+00:00","og_image":[{"width":2000,"height":1126,"url":"http:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/03\/Python-Language.jpg","type":"image\/jpeg"}],"author":"Great Learning Editorial Team","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/Great_Learning","twitter_site":"@Great_Learning","twitter_misc":{"Written by":"Great Learning Editorial Team","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.mygreatlearning.com\/blog\/python-queue\/#article","isPartOf":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/python-queue\/"},"author":{"name":"Great Learning Editorial Team","@id":"https:\/\/www.mygreatlearning.com\/blog\/#\/schema\/person\/6f993d1be4c584a335951e836f2656ad"},"headline":"Python Queue","datePublished":"2022-05-05T05:15:59+00:00","dateModified":"2024-10-14T18:25:47+00:00","mainEntityOfPage":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/python-queue\/"},"wordCount":1874,"commentCount":0,"publisher":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/python-queue\/#primaryimage"},"thumbnailUrl":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/03\/Python-Language.jpg","keywords":["python"],"articleSection":["IT\/Software Development"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.mygreatlearning.com\/blog\/python-queue\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.mygreatlearning.com\/blog\/python-queue\/","url":"https:\/\/www.mygreatlearning.com\/blog\/python-queue\/","name":"Python Queue","isPartOf":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/python-queue\/#primaryimage"},"image":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/python-queue\/#primaryimage"},"thumbnailUrl":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/03\/Python-Language.jpg","datePublished":"2022-05-05T05:15:59+00:00","dateModified":"2024-10-14T18:25:47+00:00","description":"Python Queue : A queue can be implemented in programming languages such as Python, Java, C++, etc.","breadcrumb":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/python-queue\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.mygreatlearning.com\/blog\/python-queue\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.mygreatlearning.com\/blog\/python-queue\/#primaryimage","url":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/03\/Python-Language.jpg","contentUrl":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/03\/Python-Language.jpg","width":2000,"height":1126,"caption":"Python Language"},{"@type":"BreadcrumbList","@id":"https:\/\/www.mygreatlearning.com\/blog\/python-queue\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog","item":"https:\/\/www.mygreatlearning.com\/blog\/"},{"@type":"ListItem","position":2,"name":"IT\/Software Development","item":"https:\/\/www.mygreatlearning.com\/blog\/software\/"},{"@type":"ListItem","position":3,"name":"Python Queue"}]},{"@type":"WebSite","@id":"https:\/\/www.mygreatlearning.com\/blog\/#website","url":"https:\/\/www.mygreatlearning.com\/blog\/","name":"Great Learning Blog","description":"Learn, Upskill &amp; Career Development Guide and Resources","publisher":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/#organization"},"alternateName":"Great Learning","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.mygreatlearning.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.mygreatlearning.com\/blog\/#organization","name":"Great Learning","url":"https:\/\/www.mygreatlearning.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.mygreatlearning.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/06\/GL-Logo.jpg","contentUrl":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/06\/GL-Logo.jpg","width":900,"height":900,"caption":"Great Learning"},"image":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/GreatLearningOfficial\/","https:\/\/x.com\/Great_Learning","https:\/\/www.instagram.com\/greatlearningofficial\/","https:\/\/www.linkedin.com\/school\/great-learning\/","https:\/\/in.pinterest.com\/greatlearning12\/","https:\/\/www.youtube.com\/user\/beaconelearning\/"],"description":"Great Learning is a leading global ed-tech company for professional training and higher education. It offers comprehensive, industry-relevant, hands-on learning programs across various business, technology, and interdisciplinary domains driving the digital economy. These programs are developed and offered in collaboration with the world's foremost academic institutions.","email":"info@mygreatlearning.com","legalName":"Great Learning Education Services Pvt. Ltd","foundingDate":"2013-11-29","numberOfEmployees":{"@type":"QuantitativeValue","minValue":"1001","maxValue":"5000"}},{"@type":"Person","@id":"https:\/\/www.mygreatlearning.com\/blog\/#\/schema\/person\/6f993d1be4c584a335951e836f2656ad","name":"Great Learning Editorial Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/02\/unnamed.webp","url":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/02\/unnamed.webp","contentUrl":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/02\/unnamed.webp","caption":"Great Learning Editorial Team"},"description":"The Great Learning Editorial Staff includes a dynamic team of subject matter experts, instructors, and education professionals who combine their deep industry knowledge with innovative teaching methods. Their mission is to provide learners with the skills and insights needed to excel in their careers, whether through upskilling, reskilling, or transitioning into new fields.","sameAs":["https:\/\/www.mygreatlearning.com\/","https:\/\/in.linkedin.com\/school\/great-learning\/","https:\/\/x.com\/https:\/\/twitter.com\/Great_Learning","https:\/\/www.youtube.com\/channel\/UCObs0kLIrDjX2LLSybqNaEA"],"award":["Best EdTech Company of the Year 2024","Education Economictimes Outstanding Education\/Edtech Solution Provider of the Year 2024","Leading E-learning Platform 2024"],"url":"https:\/\/www.mygreatlearning.com\/blog\/author\/greatlearning\/"}]}},"uagb_featured_image_src":{"full":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/03\/Python-Language.jpg",2000,1126,false],"thumbnail":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/03\/Python-Language-150x150.jpg",150,150,true],"medium":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/03\/Python-Language-300x169.jpg",300,169,true],"medium_large":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/03\/Python-Language-768x432.jpg",768,432,true],"large":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/03\/Python-Language-1024x577.jpg",1024,577,true],"1536x1536":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/03\/Python-Language-1536x865.jpg",1536,865,true],"2048x2048":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/03\/Python-Language.jpg",2000,1126,false],"web-stories-poster-portrait":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/03\/Python-Language-640x853.jpg",640,853,true],"web-stories-publisher-logo":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/03\/Python-Language-96x96.jpg",96,96,true],"web-stories-thumbnail":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/03\/Python-Language-150x84.jpg",150,84,true]},"uagb_author_info":{"display_name":"Great Learning Editorial Team","author_link":"https:\/\/www.mygreatlearning.com\/blog\/author\/greatlearning\/"},"uagb_comment_info":0,"uagb_excerpt":"Introduction A queue is a type of data structure that holds data in a First in First Out manner. Queue follows a specific order for the operations to be performed on the data. The queue is widely implemented as a waiting list for single shared resources or devices such as Printers, CPU, Disk, etc. There&hellip;","_links":{"self":[{"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/posts\/67120","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/users\/41"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/comments?post=67120"}],"version-history":[{"count":17,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/posts\/67120\/revisions"}],"predecessor-version":[{"id":110863,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/posts\/67120\/revisions\/110863"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/media\/63040"}],"wp:attachment":[{"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/media?parent=67120"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/categories?post=67120"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/tags?post=67120"},{"taxonomy":"content_type","embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/content_type?post=67120"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}