{"id":85577,"date":"2019-08-08T17:50:47","date_gmt":"2019-08-08T17:50:47","guid":{"rendered":"https:\/\/www.softwaretestinghelp.com\/?page_id=85577"},"modified":"2025-04-01T08:11:18","modified_gmt":"2025-04-01T08:11:18","slug":"priority-queue-in-cpp","status":"publish","type":"page","link":"https:\/\/www.softwaretestinghelp.com\/priority-queue-in-cpp\/","title":{"rendered":"Priority Queue Data Structure In C++ With Illustration"},"content":{"rendered":"<p><strong>Introduction To Priority Queue In C++ With Illustration.<\/strong><\/p>\n<p>Priority Queue is an extension of the queue that we discussed in our last tutorial.<\/p>\n<p><strong>It is similar to the queue in certain aspects and yet it differs from the ordinary queue in the following points:<\/strong><\/p>\n<ul>\n<li>Each item in the priority queue is associated with a priority.<\/li>\n<li>The item with the highest priority is the first item to be removed from the queue.<\/li>\n<li>If more than one item has the same priority, then their order in the queue is considered.<\/li>\n<\/ul>\n<p><strong>=&gt; <a href=\"https:\/\/www.softwaretestinghelp.com\/cpp-tutorials\/\">Click Here For The Absolute C++ Training Series.<\/a><\/strong><\/p>\n<p><em><strong> <\/strong><\/em><\/p>\n<p><a href=\"https:\/\/www.softwaretestinghelp.com\/wp-content\/qa\/uploads\/2019\/07\/Data-Structure-in-c_-Priority-Queue.png\"><img decoding=\"async\" class=\"alignnone wp-image-85678 size-full\" src=\"https:\/\/www.softwaretestinghelp.com\/wp-content\/qa\/uploads\/2019\/07\/Data-Structure-in-c_-Priority-Queue.png\" alt=\" Priority Queue in C++\" width=\"650\" height=\"366\" srcset=\"https:\/\/www.softwaretestinghelp.com\/wp-content\/qa\/uploads\/2019\/07\/Data-Structure-in-c_-Priority-Queue.png 650w, https:\/\/www.softwaretestinghelp.com\/wp-content\/qa\/uploads\/2019\/07\/Data-Structure-in-c_-Priority-Queue-300x169.png 300w\" sizes=\"(max-width: 650px) 100vw, 650px\" \/><\/a><\/p>\n<p>We can visualize the priority queue as a modified version of the queue except that when the item is to be taken off the queue, the item with the highest priority is retrieved first. So we prefer to use the priority queues instead of the queues when we need to process the items based on priority.<\/p>\n<h3>Basic Operations<\/h3>\n<p><strong>Let us discuss some of the basic operations supported by the priority queue.<\/strong><\/p>\n<ul>\n<li><strong>Insert(item, priority):<\/strong> Inserts an item into the priority queue with a given priority.<\/li>\n<li><strong>getHighestPriority():<\/strong> Returns an item with the highest priority.<\/li>\n<li><strong>deleteHighestPriority():<\/strong> Removes an item with the highest priority.<\/li>\n<\/ul>\n<p>Apart from the above operations, we can also use the normal queue operations like isEmpty (), isFull () and peek ().<\/p>\n<h3>Illustration<\/h3>\n<p>Let us see an illustration of the priority queue. For simplicity purposes, we will use ASCII characters as items in the priority queue. The higher the ASCII value, the higher is the priority.<\/p>\n<p>Initial state \u2013 Priority Queue (PQ) \u2013 {} =&gt;empty<\/p>\n<p><a href=\"https:\/\/www.softwaretestinghelp.com\/wp-content\/qa\/uploads\/2019\/07\/illustration-of-the-priority-queue.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-85578\" src=\"https:\/\/www.softwaretestinghelp.com\/wp-content\/qa\/uploads\/2019\/07\/illustration-of-the-priority-queue.png\" alt=\"illustration of the priority queue\" width=\"638\" height=\"354\" srcset=\"https:\/\/www.softwaretestinghelp.com\/wp-content\/qa\/uploads\/2019\/07\/illustration-of-the-priority-queue.png 638w, https:\/\/www.softwaretestinghelp.com\/wp-content\/qa\/uploads\/2019\/07\/illustration-of-the-priority-queue-300x166.png 300w\" sizes=\"(max-width: 638px) 100vw, 638px\" \/><\/a><\/p>\n<p>From the above illustration, we see that the insert operation is similar to an ordinary queue. But when we call the \u201cdeleteHighestPriority\u201d for the priority queue, the element with the highest priority is removed first.<\/p>\n<p>Hence the first time when we call this function,\u00a0item O is removed while the second time, the item M is removed as it has higher priority than G and A.<\/p>\n<h3>Implementation Of Priority Queues In C++<\/h3>\n<p><strong>Priority queues can be implemented using:<\/strong><\/p>\n<h4><span style=\"color: #ff6600;\">#1) Arrays\/ Linked lists<\/span><\/h4>\n<p>We can implement the priority queues using arrays and this is the simplest implementation for the priority queues.<\/p>\n<p><strong> To represent the items in the priority queue, we can just declare a struct as below:<\/strong><\/p>\n<pre>struct pq_item{\r\n               int item;\r\n               int priority;\r\n};<\/pre>\n<p>We have declared the priority as well for each item.<\/p>\n<p>To insert a new item in the priority queue we simply have to insert the item at the end of the array.<\/p>\n<p>To get the element from the queue using getHighestPriority (), we need to traverse the array from the start and return the item with the highest priority.<\/p>\n<p>Similarly, to remove the item from the queue using the deleteHighestPriority operation, we need to traverse the entire array and delete the item with the highest priority. Then move all the other elements after the deleted item, one position back.<\/p>\n<p>We can also implement the priority queue using a linked list. We can perform all the operations in a similar way like arrays. The only difference is that we need not move the elements after calling deleteHighestPriority.<\/p>\n<h4><span style=\"color: #ff6600;\">#2) Heaps<\/span><\/h4>\n<p>Using heaps to implement a priority queue is the most efficient way and it provides a lot better performance when compared to the linked lists and arrays. Contrary to the linked list and array, heap implementation takes O (logn) time for insert and delete operations of the priority queue. Get operation, getHighestPriority takes O(1) time.<\/p>\n<h4><span style=\"color: #ff6600;\">#3) In-built Priority Queue In Standard Template Library(STL) In C++<\/span><\/h4>\n<p>In C++, we have a priority queue as a container adaptive class, designed in such a way that the highest element is the first element in the queue and all the elements are in the decreasing order.<\/p>\n<p>Thus each item in the priority queue has a fixed priority.<\/p>\n<p>We have class &lt;queue&gt; in STL, which contains the priority queue implementation.<\/p>\n<p><strong>The various operations supported by the priority queue are as follows:<\/strong><\/p>\n<ol>\n<li><strong>priority_queue::size(): <\/strong>Returns the size of the queue.<\/li>\n<li><strong>priority_queue::empty(): <\/strong>Checks if the queue is empty and returns its status.<\/li>\n<li><strong>priority_queue:: top(): <\/strong>Returns a reference to the topmost element of the priority queue.<\/li>\n<li><strong>priority_queue::push(): <\/strong>Adds an item at the end of the priority queue.<\/li>\n<li><strong>priority_queue::pop(): <\/strong>Removes the first element from the priority queue.<\/li>\n<li><strong>priority_queue:: swap (): <\/strong>Used to swap the contents of one priority queue with another one of the same type and size.<\/li>\n<li><strong>priority queue value type: <\/strong>Value type gives the type of the element stored inside a priority queue. This also acts as a synonym for the template parameter.<\/li>\n<li><strong>priority_queue:: emplace (): <\/strong>Used to insert a new element in the priority queue container at the top of the queue.<\/li>\n<\/ol>\n<p><strong>In the next program, we will see the functionality of the priority queue in STL in C++.<\/strong><\/p>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">#include &lt;iostream&gt; \r\n#include &lt;queue&gt; \r\nusing namespace std; \r\n  \r\nvoid displaypq(priority_queue &lt;int&gt; pq) \r\n{ \r\n    priority_queue &lt;int&gt; pqueue = pq; \r\n    while (!pqueue.empty()) \r\n    { \r\n        cout &lt;&lt; '\\t' &lt;&lt; pqueue.top(); \r\n        pqueue.pop(); \r\n    } \r\n    cout &lt;&lt; '\\n'; \r\n} \r\n  \r\nint main () \r\n{ \r\n    priority_queue &lt;int&gt; pq; \r\npq.push(1); \r\npq.push(3); \r\npq.push(5); \r\npq.push(7); \r\npq.push(9); \r\n  \r\ncout &lt;&lt; &quot;Size of the queue(pq.size()): &quot; &lt;&lt; pq.size(); \r\ncout &lt;&lt; &quot;\\nTop element of the queue(pq.top()): &quot; &lt;&lt; pq.top(); \r\ncout &lt;&lt; &quot;\\nThe priority queue pq is : &quot;; \r\ndisplaypq(pq); \r\n    \r\ncout &lt;&lt; &quot;\\nPriority queue, after pq.pop() operation : &quot;; \r\npq.pop(); \r\ndisplaypq(pq); \r\n  \r\nreturn 0; \r\n} <\/pre>\n<p><strong>Output:<\/strong><\/p>\n<p>Size\u00a0of\u00a0the\u00a0queue(pq.size()):\u00a05<br \/>\nTop\u00a0element\u00a0of\u00a0the\u00a0queue(pq.top()):\u00a09<br \/>\nThe priority queue pq is:\u00a0 9\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a07\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a05\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 3\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 1<br \/>\nPriority queue, after pq.pop() operation :\u00a0\u00a0\u00a0\u00a0\u00a0\u00a07\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a05\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a03\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 1<\/p>\n<p><strong>Java Implementation for Priority Queue<\/strong><\/p>\n<p>Priority queue in java is a special queue where all the elements in the queue are ordered according to natural ordering or custom ordering using a comparator supplied with the queue.<\/p>\n<p><strong>A priority queue in Java looks as shown below:<\/strong><\/p>\n<p><a href=\"https:\/\/www.softwaretestinghelp.com\/wp-content\/qa\/uploads\/2019\/07\/Java-Implementation-for-priority-queue.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-85665\" src=\"https:\/\/www.softwaretestinghelp.com\/wp-content\/qa\/uploads\/2019\/07\/Java-Implementation-for-priority-queue.png\" alt=\"Java Implementation for priority queue\" width=\"615\" height=\"152\" srcset=\"https:\/\/www.softwaretestinghelp.com\/wp-content\/qa\/uploads\/2019\/07\/Java-Implementation-for-priority-queue.png 615w, https:\/\/www.softwaretestinghelp.com\/wp-content\/qa\/uploads\/2019\/07\/Java-Implementation-for-priority-queue-300x74.png 300w\" sizes=\"(max-width: 615px) 100vw, 615px\" \/><\/a><\/p>\n<p>In Java priority queue, the elements are arranged such that the least element is at the front of the queue and the greatest element is at the rear of the queue. So when we remove the element from the priority queue, it is always the smallest element that is removed.<\/p>\n<p>The class that implements the priority queue in Java is \u201cPriorityQueue\u201d and is a part of the collections framework of Java. It implements the \u201cQueue\u201d interface of Java.<\/p>\n<p><strong>Following is the class hierarchy for Java PriorityQueue class.<\/strong><\/p>\n<p><a href=\"https:\/\/www.softwaretestinghelp.com\/wp-content\/qa\/uploads\/2019\/07\/class-hierarchy-for-Java-PriorityQueue-class.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-85666\" src=\"https:\/\/www.softwaretestinghelp.com\/wp-content\/qa\/uploads\/2019\/07\/class-hierarchy-for-Java-PriorityQueue-class.png\" alt=\"class hierarchy for Java PriorityQueue class\" width=\"412\" height=\"394\" srcset=\"https:\/\/www.softwaretestinghelp.com\/wp-content\/qa\/uploads\/2019\/07\/class-hierarchy-for-Java-PriorityQueue-class.png 412w, https:\/\/www.softwaretestinghelp.com\/wp-content\/qa\/uploads\/2019\/07\/class-hierarchy-for-Java-PriorityQueue-class-300x287.png 300w\" sizes=\"(max-width: 412px) 100vw, 412px\" \/><\/a><\/p>\n<p><span style=\"text-decoration: underline;\"><strong>Given below is an Example of Priority Queue functionality with integers as items in Java.<\/strong><\/span><\/p>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">import java.util.*; \r\n  \r\nclass Main\r\n{ \r\n\r\npublic static void main(String args&#x5B;]) \r\n    { \r\n        \/\/ Create empty priority queue \r\n        PriorityQueue&lt;Integer&gt; priority_Queue = \r\nnew PriorityQueue&lt;Integer&gt;(); \r\n  \r\n        \/\/ Adding items to the priority_Queue using add() \r\npriority_Queue.add(1); \r\npriority_Queue.add(3); \r\npriority_Queue.add(5); \r\npriority_Queue.add(7); \r\n  \r\n        \/\/ display the most priority element \r\nSystem.out.println(&quot;peek()::Head value:&quot; + priority_Queue.peek()); \r\n  \r\n        \/\/ Print all elements in Priotity queue\r\nSystem.out.println(&quot;The priority queue:&quot;);  \r\n        Iterator itr = priority_Queue.iterator(); \r\nwhile (itr.hasNext()) \r\nSystem.out.print(itr.next() + &quot; &quot;); \r\n  \r\n        \/\/ poll() function to remove the queue elements \r\npriority_Queue.poll(); \r\nSystem.out.println(&quot;\\nAfter poll() function, priority queue:&quot;); \r\n        Iterator&lt;Integer&gt; itr2 = priority_Queue.iterator(); \r\nwhile (itr2.hasNext()) \r\nSystem.out.print(itr2.next() + &quot; &quot;); \r\n  \r\n        \/\/ remove() function with priority queue \r\npriority_Queue.remove(5); \r\nSystem.out.println(&quot;\\n\\nAfter Remove(5) function, priority queue:&quot;); \r\n        Iterator&lt;Integer&gt; itr3 = priority_Queue.iterator(); \r\nwhile (itr3.hasNext()) \r\nSystem.out.print(itr3.next() + &quot; &quot;); \r\n  \r\n        \/\/ Check if an element is present using contains() \r\nboolean b = priority_Queue.contains(3); \r\nSystem.out.println ( &quot;\\nPriority queue contains 3?: &quot; + b); \r\n  \r\n        \/\/ use toArray() function to get objects from the queue and display the array elements\r\nObject&#x5B;] arr = priority_Queue.toArray(); \r\nSystem.out.println ( &quot;Array elements: &quot;); \r\nfor (int i = 0; i&lt;arr.length; i++) \r\nSystem.out.println ( &quot;Value: &quot; + arr&#x5B;i].toString()) ; \r\n    } \r\n}\r\n<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<p>peek()::Head\u00a0value:1<br \/>\nThe\u00a0priority\u00a0queue:<br \/>\n1\u00a0 \u00a0 \u00a0 3\u00a0 \u00a0 \u00a0 \u00a05\u00a0 \u00a0 \u00a0 7<br \/>\nAfter\u00a0poll()\u00a0function,\u00a0priority\u00a0queue:<br \/>\n3\u00a0 \u00a0 7\u00a0 \u00a0 \u00a05<br \/>\nAfter\u00a0Remove(5)\u00a0function,\u00a0priority\u00a0queue:<br \/>\n3\u00a0 \u00a0 \u00a07<br \/>\nPriority\u00a0queue\u00a0contains\u00a03?:\u00a0true<br \/>\nArray\u00a0elements:<br \/>\nValue:\u00a03<br \/>\nValue:\u00a07<\/p>\n<p>In the above program, we make use of the PriorityQueue class of Java to create an object of PriorityQueue that contains an Integer object. We add elements into the queue using the \u201cadd\u201d function. Then the poll() function is called and it deletes the element from the front of the queue which happens to be the least element.<\/p>\n<p>Again we call the \u201cremove()\u201d function which removes the element specified as a parameter from the queue. We also use \u201cContains()\u201d function to check if a particular element is present in the queue. Finally, we convert the queue into an array object using the \u201ctoArray()\u201d function.<\/p>\n<h3>Application<\/h3>\n<ul>\n<li><strong>Operating system load balancing and interrupt handlers: <\/strong>Operating system functions like load balancing and interrupts handling is implemented using priority queues. The load balancing activity schedules the resources with the highest priority in order to effectively carry our load balancing. Interrupt handling is performed by servicing the interrupts with the highest priority. This functionality can be effectively implemented using the priority queues.<\/li>\n<li><strong>Routing: <\/strong>Routing is a function that is used to route the network resources so that we get maximum throughput with minimum turnaround time. This can also be implemented using the priority queue.<\/li>\n<li><strong>Hospital Emergency: <\/strong>In a hospital emergency room, the patients are attended according to how severe the condition of the patient is. This can be simulated using priority queues.<\/li>\n<li><strong>Dijkstra\u2019s Shortest Path Algorithm: <\/strong>Here the graph is stored as an adjacency list and we can use a priority queue to extract the minimum weighted edge efficiently from the adjacency list to implement Dijkstra\u2019s shortest path algorithm.<\/li>\n<li>Priority queue can also be used to store node keys and extract the minimum key node while implementing spanning tree.<\/li>\n<\/ul>\n<h3>Conclusion<\/h3>\n<p>Priority queues are nothing but the extension of the queue. But unlike queues which add\/remove items using the FIFO approach, in priority queue the items are removed from the queue according to the priority. Thus each item in the queue is associated with a priority and the item with the highest priority is the first one to be taken off the queue.<\/p>\n<p>The priority queue has three main operations i.e. insert (), getHighestPriority () and deleteHighestPriority (). Priority queue can be implemented using arrays or linked list but the working is not very efficient. Priority queue can also be implemented using heaps and the performance is much faster.<\/p>\n<p>In C++, we also have a container class &lt;queue&gt; that implements the functionality of a priority queue. In Java, there is a built-in class priority_queue that provides the functionality of a priority queue.<\/p>\n<p>The priority queue is mainly used in applications that require items to be processed according to the priority. <span style=\"text-decoration: underline;\"><strong>For Example,<\/strong><\/span> it is used in interrupt handling.<\/p>\n<p>Our upcoming tutorial will explore all about circular queue which is yet another extension of the queue.<\/p>\n<p><strong>=&gt; <a href=\"https:\/\/www.softwaretestinghelp.com\/cpp-tutorials\/\">Visit Here For The Complete C++ Course From Experts.<\/a><\/strong><\/p>\n\r\n\t\t\t<div id=\"daexthefup-container\"\r\n\t\t\t\tclass=\"daexthefup-container daexthefup-layout-stacked daexthefup-alignment-center\"\r\n\t\t\t\tdata-post-id=\"85577\">\r\n\r\n\t\t\t\t<div class=\"daexthefup-feedback\">\r\n\t\t\t\t\t<div class=\"daexthefup-text\">\r\n\t\t\t\t\t\t<h3 class=\"daexthefup-title\">Was this helpful?<\/h3>\r\n\t\t\t\t\t<\/div>\r\n\t\t\t\t\t<div class=\"daexthefup-buttons-container\">\r\n\t\t\t\t\t\t<div class=\"daexthefup-buttons\">\r\n\t\t\t\t\t\t\t\r\n\t\t\t<div class=\"daexthefup-yes daexthefup-button daexthefup-button-type-icon\" data-value=\"1\">\r\n\t\t\t\t\r\n                <svg>\r\n                    <defs>\r\n                        <style>.thumb-up-cls-1{fill:#c9c9c9;}.thumb-up-cls-2{fill:#e1e1e1;}.thumb-up-cls-3{fill:#676767;}<\/style>\r\n                    <\/defs>\r\n                    <g id=\"thumb_up\">\r\n                        <path class=\"thumb-up-cls-2 daexthefup-icon-circle\" d=\"m24,3c11.58,0,21,9.42,21,21s-9.42,21-21,21S3,35.58,3,24,12.42,3,24,3m0-1C11.85,2,2,11.85,2,24s9.85,22,22,22,22-9.85,22-22S36.15,2,24,2h0Z\" \/>\r\n                        <g>\r\n                            <rect class=\"thumb-up-cls-3 daexthefup-icon-secondary-color\" x=\"10\" y=\"20\" width=\"6\" height=\"15\" rx=\"1.5\" ry=\"1.5\" \/>\r\n                            <path class=\"thumb-up-cls-1 daexthefup-icon-primary-color\" d=\"m30.57,9.06l-.49-.1c-.81-.17-1.61.35-1.78,1.16l-5.3,11.74c-.17.81,3.16,1.61,3.97,1.78l1.96.41c.81.17,1.61-.35,1.78-1.16l2.18-10.27c.34-1.61-.7-3.21-2.31-3.56Z\" \/>\r\n                            <path class=\"thumb-up-cls-1 daexthefup-icon-primary-color\" d=\"m38.17,20h-18.67c-.83,0-1.5.67-1.5,1.5v12c0,.83.67,1.5,1.5,1.5h16.27c.71,0,1.33-.5,1.47-1.21l2.4-12c.19-.93-.53-1.8-1.47-1.8Z\" \/>\r\n                        <\/g>\r\n                    <\/g>\r\n                <\/svg>\t\t\t<\/div>\r\n\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t<div class=\"daexthefup-no daexthefup-button daexthefup-button-type-icon\" data-value=\"0\">\r\n\t\t\t\t\r\n                <svg>\r\n                    <defs>\r\n                        <style>.thumb-down-cls-1{fill:#c9c9c9;}.thumb-down-cls-2{fill:#e1e1e1;}.thumb-down-cls-3{fill:#676767;}<\/style>\r\n                    <\/defs>\r\n                    <g id=\"thumb_down\">\r\n                        <path class=\"thumb-down-cls-2 daexthefup-icon-circle\" d=\"m24,3c11.58,0,21,9.42,21,21s-9.42,21-21,21S3,35.58,3,24,12.42,3,24,3m0-1C11.85,2,2,11.85,2,24s9.85,22,22,22,22-9.85,22-22S36.15,2,24,2h0Z\" \/>\r\n                        <g>\r\n                            <rect class=\"thumb-down-cls-3 daexthefup-icon-secondary-color\" x=\"10\" y=\"13\" width=\"6\" height=\"15\" rx=\"1.5\" ry=\"1.5\" \/>\r\n                            <path class=\"thumb-down-cls-1 daexthefup-icon-primary-color\" d=\"m30.57,38.94l-.49.1c-.81.17-1.61-.35-1.78-1.16l-5.3-11.74c-.17-.81,3.16-1.61,3.97-1.78l1.96-.41c.81-.17,1.61.35,1.78,1.16l2.18,10.27c.34,1.61-.7,3.21-2.31,3.56Z\" \/>\r\n                            <path class=\"thumb-down-cls-1 daexthefup-icon-primary-color\" d=\"m38.17,28h-18.67c-.83,0-1.5-.67-1.5-1.5v-12c0-.83.67-1.5,1.5-1.5h16.27c.71,0,1.33.5,1.47,1.21l2.4,12c.19.93-.53,1.8-1.47,1.8Z\" \/>\r\n                        <\/g>\r\n                    <\/g>\r\n                <\/svg>\t\t\t<\/div>\r\n\r\n\t\t\t\t\t\t\t\t\t<\/div>\r\n\t\t\t\t\t<\/div>\r\n\t\t\t\t<\/div>\r\n\r\n\t\t\t\t<div class=\"daexthefup-comment\">\r\n\t\t\t\t\t<div class=\"daexthefup-comment-top-container\">\r\n\t\t\t\t\t\t<label id=\"daexthefup-comment-label\" class=\"daexthefup-comment-label\"><\/label>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div class=\"daexthefup-comment-character-counter-container\">\r\n\t\t\t\t\t\t\t\t<div id=\"daexthefup-comment-character-counter-number\"\r\n\t\t\t\t\t\t\t\t\tclass=\"daexthefup-comment-character-counter-number\"><\/div>\r\n\t\t\t\t\t\t\t\t<div class=\"daexthefup-comment-character-counter-text\"><\/div>\r\n\t\t\t\t\t\t\t<\/div>\r\n\t\t\t\t\t\t\t\t\t\t\t<\/div>\r\n\t\t\t\t\t<textarea id=\"daexthefup-comment-textarea\" class=\"daexthefup-comment-textarea\"\r\n\t\t\t\t\t\t\t\tplaceholder=\"Type your message\"\r\n\t\t\t\t\t\t\t\tmaxlength=\"\r\n\t\t\t\t\t\t\t\t400\t\t\t\t\t\t\t\t\t\"><\/textarea>\r\n\t\t\t\t\t<div class=\"daexthefup-comment-buttons-container\">\r\n\t\t\t\t\t\t<button class=\"daexthefup-comment-submit daexthefup-button\">Submit<\/button>\r\n\t\t\t\t\t\t<button class=\"daexthefup-comment-cancel daexthefup-button\">Cancel<\/button>\r\n\t\t\t\t\t<\/div>\r\n\t\t\t\t<\/div>\r\n\r\n\t\t\t\t<div class=\"daexthefup-successful-submission-text\">Thanks for your feedback!<\/div>\r\n\r\n\t\t\t<\/div>\r\n\r\n\t\t\t","protected":false},"excerpt":{"rendered":"<p>Introduction To Priority Queue In C++ With Illustration. Priority Queue is an extension of the queue that we discussed in our last tutorial. It is similar to the queue in certain aspects and yet it differs from the ordinary queue in the following points: Each item in the priority queue &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"Priority Queue Data Structure In C++ With Illustration\" class=\"read-more button\" href=\"https:\/\/www.softwaretestinghelp.com\/priority-queue-in-cpp\/#more-85577\" aria-label=\"Read more about Priority Queue Data Structure In C++ With Illustration\">Read more<\/a><\/p>\n","protected":false},"author":9,"featured_media":85678,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"_acf_changed":false,"_helpful_pro_status":1,"footnotes":""},"categories":[403],"tags":[],"class_list":{"0":"post-85577","1":"page","2":"type-page","3":"status-publish","4":"has-post-thumbnail","6":"category-cpp"},"acf":[],"_links":{"self":[{"href":"https:\/\/www.softwaretestinghelp.com\/wp-json\/wp\/v2\/pages\/85577","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.softwaretestinghelp.com\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.softwaretestinghelp.com\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.softwaretestinghelp.com\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/www.softwaretestinghelp.com\/wp-json\/wp\/v2\/comments?post=85577"}],"version-history":[{"count":0,"href":"https:\/\/www.softwaretestinghelp.com\/wp-json\/wp\/v2\/pages\/85577\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.softwaretestinghelp.com\/wp-json\/wp\/v2\/media\/85678"}],"wp:attachment":[{"href":"https:\/\/www.softwaretestinghelp.com\/wp-json\/wp\/v2\/media?parent=85577"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.softwaretestinghelp.com\/wp-json\/wp\/v2\/categories?post=85577"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.softwaretestinghelp.com\/wp-json\/wp\/v2\/tags?post=85577"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}