title
4.2 Implementation of Queue using Arrays | Data Structures & Algorithm Tutorials
description
In this lecture I have described array based implementation of queue data structure. I have written C program to implement queue using arrays.
DSA Full Course: https: https://www.youtube.com/playlist?list=PLdo5W4Nhv31bbKJzrsKfMpo_grxuLl8LU
******************************************
See Complete Playlists:
C Programming Course: https://www.youtube.com/playlist?list=PLdo5W4Nhv31a8UcMN9-35ghv8qyFWD9_S
C++ Programming: https://www.youtube.com/playlist?list=PLdo5W4Nhv31YU5Wx1dopka58teWP9aCee
Python Full Course: https://www.youtube.com/playlist?list=PLdo5W4Nhv31bZSiqiOL5ta39vSnBxpOPT
Printing Pattern in C: https://www.youtube.com/playlist?list=PLdo5W4Nhv31Yu1igxTE2x0aeShbKtVcCy
DAA Course: https://www.youtube.com/playlist?list=PLdo5W4Nhv31ZTn2P9vF02bkb3SC8uiUUn
Placement Series: https://www.youtube.com/playlist?list=PLdo5W4Nhv31YvlDpJhvOYbM9Ap8UypgEy
Dynamic Programming: https://www.youtube.com/playlist?list=PLdo5W4Nhv31aBrJE1WS4MR9LRfbmZrAQu
Operating Systems: //www.youtube.com/playlist?list=PLdo5W4Nhv31a5ucW_S1K3-x6ztBRD-PNa
DBMS: https://www.youtube.com/playlist?list=PLdo5W4Nhv31b33kF46f9aFjoJPOkdlsRc
*********************************************
Connect & Contact Me:
Facebook: https://www.facebook.com/Jennys-Lectures-CSIT-Netjrf-316814368950701/
Quora: https://www.quora.com/profile/Jayanti-Khatri-Lamba
Instagram: https://www.instagram.com/jayantikhatrilamba/
#jennyslectures, #datastructures #queue #queueimplementation
detail
{'title': '4.2 Implementation of Queue using Arrays | Data Structures & Algorithm Tutorials', 'heatmap': [{'end': 736.881, 'start': 648.792, 'weight': 0.934}, {'end': 929.069, 'start': 900.746, 'weight': 0.759}, {'end': 1141.129, 'start': 1107.334, 'weight': 0.777}], 'summary': 'This tutorial introduces the implementation of a queue using arrays, covering the logical representation, fifo rule enforcement, time complexity of insertion and deletion operations, and array implementation details such as overflow conditions and handling of empty and full queues, with a specific focus on implementing the queue using arrays and addressing the time complexity for nq and dq operations being order of one.', 'chapters': [{'end': 171.82, 'segs': [{'end': 78.2, 'src': 'embed', 'start': 45.393, 'weight': 2, 'content': [{'end': 48.433, 'text': 'this is how, logically, you can represent a queue.', 'start': 45.393, 'duration': 3.04}, {'end': 49.874, 'text': 'this is what front.', 'start': 48.433, 'duration': 1.441}, {'end': 51.314, 'text': 'this is what rear.', 'start': 49.874, 'duration': 1.44}, {'end': 59.316, 'text': 'right, you can insert data from rear end and if you want to delete the data, then you can delete from front right.', 'start': 51.314, 'duration': 8.002}, {'end': 65.376, 'text': 'and if you suppose, consider here front and here rear, that is also fine.', 'start': 59.316, 'duration': 6.06}, {'end': 71.478, 'text': 'so insertion would be from rear and deletion would be from front right.', 'start': 65.376, 'duration': 6.102}, {'end': 78.2, 'text': 'you can choose any option, fine, but you have to take care of the rule of insertion and deletion.', 'start': 71.478, 'duration': 6.722}], 'summary': 'Logically represent a queue with insertion from rear and deletion from front.', 'duration': 32.807, 'max_score': 45.393, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/YqrFeU90Coo/pics/YqrFeU90Coo45393.jpg'}, {'end': 149.292, 'src': 'embed', 'start': 94.121, 'weight': 0, 'content': [{'end': 100.944, 'text': 'the capacity of the queue and while implementation of the queue, you have to take care of that rule.', 'start': 94.121, 'duration': 6.823}, {'end': 108.547, 'text': 'that is FIFO rule, because queue follows what FIFO rule first in first out that we have discussed in the previous video right.', 'start': 100.944, 'duration': 7.603}, {'end': 112.388, 'text': 'so obviously we are implementing this q using array.', 'start': 109.207, 'duration': 3.181}, {'end': 120.412, 'text': 'so you have to enforce this rule here and the time complexity for nq and dq operation must be order of one see here.', 'start': 112.388, 'duration': 8.024}, {'end': 126.434, 'text': 'insertion is known as nq and deletion is known as dq operation in q right.', 'start': 120.412, 'duration': 6.022}, {'end': 129.955, 'text': 'these are more technical terms in context of q, so we will use nq and dq.', 'start': 126.434, 'duration': 3.521}, {'end': 133.718, 'text': 'Now we actually implement this queue using arrays.', 'start': 130.976, 'duration': 2.742}, {'end': 146.289, 'text': 'Fine Now how to define how to declare array like this int array name and here size of the array that is any constant 5, 10 as you wish 50, 100 right.', 'start': 133.999, 'duration': 12.29}, {'end': 149.292, 'text': 'Here I am taking the name queue.', 'start': 146.95, 'duration': 2.342}], 'summary': 'Implement a queue using arrays with fifo rule and o(1) time complexity for nq and dq operations.', 'duration': 55.171, 'max_score': 94.121, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/YqrFeU90Coo/pics/YqrFeU90Coo94121.jpg'}], 'start': 0.329, 'title': 'Implementing queue using arrays', 'summary': 'Introduces the implementation of a queue using arrays, discussing the logical representation, enforcement of fifo rule, and the time complexity of insertion and deletion operations, with a focus on implementing the queue using arrays and the time complexity for nq and dq operations being order of one.', 'chapters': [{'end': 171.82, 'start': 0.329, 'title': 'Implementing queue using arrays', 'summary': 'Introduces the implementation of a queue using arrays, discussing the logical representation of a queue, the enforcement of fifo rule, and the time complexity of insertion and deletion operations, with a focus on implementing the queue using arrays and the time complexity for nq and dq operations being order of one.', 'duration': 171.491, 'highlights': ['The time complexity for nq and dq operation must be order of one. The time complexity for nq and dq operation must be order of one, emphasizing the efficiency of the insertion and deletion operations in the queue.', 'Queue follows what FIFO rule first in first out. Emphasizes the FIFO rule, where the first element inserted into the queue is the first one to be removed.', 'Logical representation of a queue: insertion is possible from one end (rear) and deletion is possible from the other end (front). Explains the logical representation of a queue, highlighting the process of insertion and deletion from the rear and front ends respectively.']}], 'duration': 171.491, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/YqrFeU90Coo/pics/YqrFeU90Coo329.jpg', 'highlights': ['The time complexity for nq and dq operation must be order of one, emphasizing the efficiency of the insertion and deletion operations in the queue.', 'Queue follows what FIFO rule first in first out. Emphasizes the FIFO rule, where the first element inserted into the queue is the first one to be removed.', 'Logical representation of a queue: insertion is possible from one end (rear) and deletion is possible from the other end (front). Explains the logical representation of a queue, highlighting the process of insertion and deletion from the rear and front ends respectively.']}, {'end': 338.981, 'segs': [{'end': 237.096, 'src': 'embed', 'start': 188.387, 'weight': 0, 'content': [{'end': 197.651, 'text': 'dq means it is going to delete the data from the front of the queue, again peak, and then we will display the content of the queue right now.', 'start': 188.387, 'duration': 9.264}, {'end': 200.372, 'text': 'first of all, obviously we are going to declare the size.', 'start': 197.651, 'duration': 2.721}, {'end': 201.413, 'text': 'we are we are using what.', 'start': 200.372, 'duration': 1.041}, {'end': 203.874, 'text': 'static memory allocation here fine.', 'start': 201.413, 'duration': 2.461}, {'end': 210.338, 'text': 'in array you can use dynamic array also and for dynamic memory allocation you can use linked list also.', 'start': 203.874, 'duration': 6.464}, {'end': 212.9, 'text': 'fine, but here i am using static memory allocation.', 'start': 210.338, 'duration': 2.562}, {'end': 214.861, 'text': 'so i have defined int.', 'start': 212.9, 'duration': 1.961}, {'end': 218.404, 'text': 'here the name is q and size is n.', 'start': 214.861, 'duration': 3.543}, {'end': 221.286, 'text': 'see this q we will use in all the functions.', 'start': 218.404, 'duration': 2.882}, {'end': 228.491, 'text': 'that is why i am declaring it globally outside of main function and outside of all these function after header file directly right.', 'start': 221.286, 'duration': 7.205}, {'end': 232.373, 'text': 'and here i am not writing that size in constant term.', 'start': 228.491, 'duration': 3.882}, {'end': 237.096, 'text': 'I am using what macro definition hash define n 5..', 'start': 233.234, 'duration': 3.862}], 'summary': 'Implementing a queue using static memory allocation with a size of 5.', 'duration': 48.709, 'max_score': 188.387, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/YqrFeU90Coo/pics/YqrFeU90Coo188387.jpg'}, {'end': 293.618, 'src': 'embed', 'start': 266.413, 'weight': 1, 'content': [{'end': 269.336, 'text': 'now, front and rear in q.', 'start': 266.413, 'duration': 2.923}, {'end': 271.638, 'text': 'these are two important parts that we have discussed.', 'start': 269.336, 'duration': 2.302}, {'end': 275.102, 'text': 'so you have to take two variables.', 'start': 271.638, 'duration': 3.464}, {'end': 286.575, 'text': 'one is front, and we will initialize this front first of all with minus one, and rear is equal to also minus one globally,', 'start': 275.102, 'duration': 11.473}, {'end': 291.177, 'text': 'because front and rear both the variables we will use in each function.', 'start': 286.575, 'duration': 4.602}, {'end': 293.618, 'text': 'that is why i am declaring these variables globally,', 'start': 291.177, 'duration': 2.441}], 'summary': 'Discussion on two important parts: front and rear in queue, with initialization of front and rear variables to -1 globally.', 'duration': 27.205, 'max_score': 266.413, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/YqrFeU90Coo/pics/YqrFeU90Coo266413.jpg'}], 'start': 171.82, 'title': 'Queue operation and memory allocation', 'summary': 'Covers queue operations such as peak and dq functions, static memory allocation using macro definition, and global declaration of front and rear variables.', 'chapters': [{'end': 338.981, 'start': 171.82, 'title': 'Queue operation and memory allocation', 'summary': 'Explains the queue operations including peak and dq functions, static memory allocation with macro definition, and global declaration of front and rear variables.', 'duration': 167.161, 'highlights': ['The chapter covers queue operations such as peak and dq functions, along with the global declaration of front and rear variables, and the use of static memory allocation with macro definition.', 'The global declaration of front and rear variables allows for their use in each function, minimizing the need for repeated variable declaration within each function.', 'The use of macro definition for static memory allocation enables easy modification of the queue size and facilitates logical representation of the queue with values 1, 2, 3, 4, and 5.']}], 'duration': 167.161, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/YqrFeU90Coo/pics/YqrFeU90Coo171820.jpg', 'highlights': ['The use of macro definition for static memory allocation enables easy modification of the queue size and facilitates logical representation of the queue with values 1, 2, 3, 4, and 5.', 'The global declaration of front and rear variables allows for their use in each function, minimizing the need for repeated variable declaration within each function.', 'The chapter covers queue operations such as peak and dq functions, along with the global declaration of front and rear variables, and the use of static memory allocation with macro definition.']}, {'end': 637.129, 'segs': [{'end': 372.867, 'src': 'embed', 'start': 338.981, 'weight': 0, 'content': [{'end': 343.064, 'text': 'This is actually an array, but we are using this array for implementation of queue.', 'start': 338.981, 'duration': 4.083}, {'end': 348.066, 'text': "So you can say here I'm using this array as a queue data structure.", 'start': 343.104, 'duration': 4.962}, {'end': 351.748, 'text': 'Right Both front and rear pointing to minus 1 right now.', 'start': 348.346, 'duration': 3.402}, {'end': 354.41, 'text': 'Fine Now see.', 'start': 352.929, 'duration': 1.481}, {'end': 359.56, 'text': 'first of all you will check for the overflow condition.', 'start': 356.018, 'duration': 3.542}, {'end': 360.861, 'text': 'and what is that overflow condition?', 'start': 359.56, 'duration': 1.301}, {'end': 362.782, 'text': 'we have discussed in the previous video.', 'start': 360.861, 'duration': 1.921}, {'end': 372.867, 'text': 'when rear becomes here rear is pointing to here 4 means this n minus 1 maximum size minus 1 because we will insert from the rear.', 'start': 362.782, 'duration': 10.085}], 'summary': 'Using array as queue, checking overflow condition when rear reaches maximum size minus 1.', 'duration': 33.886, 'max_score': 338.981, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/YqrFeU90Coo/pics/YqrFeU90Coo338981.jpg'}, {'end': 422.581, 'src': 'embed', 'start': 388.001, 'weight': 1, 'content': [{'end': 388.942, 'text': 'here q is full.', 'start': 388.001, 'duration': 0.941}, {'end': 392.605, 'text': 'so first of all you will check for that thing for over overflow condition.', 'start': 388.942, 'duration': 3.663}, {'end': 408.058, 'text': 'now here you will write if rear equal to equal to n minus 1, it means here simply you can print printf overflow or you can say printf q is full.', 'start': 392.605, 'duration': 15.453}, {'end': 412.036, 'text': 'right, This thing we have discussed in detail in the previous video.', 'start': 408.058, 'duration': 3.978}, {'end': 416.138, 'text': 'You should check out that video first, right? Now, this is not a case.', 'start': 412.076, 'duration': 4.062}, {'end': 422.581, 'text': 'So, second case may be else if there is nothing in the queue like this.', 'start': 416.558, 'duration': 6.023}], 'summary': 'Checking for overflow condition in a queue, if rear equals n minus 1, print overflow message.', 'duration': 34.58, 'max_score': 388.001, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/YqrFeU90Coo/pics/YqrFeU90Coo388001.jpg'}], 'start': 338.981, 'title': 'Queue implementation', 'summary': 'Discusses the array implementation of a queue data structure, covering the overflow condition when the rear pointer reaches the maximum size minus 1, and the corresponding action, as well as the operations of inserting and deleting elements in a queue, emphasizing the handling of empty and full queues and the process of modifying front and rear pointers.', 'chapters': [{'end': 416.138, 'start': 338.981, 'title': 'Array implementation of queue', 'summary': "Discusses the array implementation of a queue data structure, covering the overflow condition, with the rear pointer reaching the maximum size minus 1, and the corresponding action of printing 'overflow' or 'q is full'.", 'duration': 77.157, 'highlights': ['The array is utilized for implementing a queue data structure, with both front and rear initially pointing to minus 1.', "Explanation of the overflow condition is provided, where if rear equals n minus 1, 'overflow' or 'q is full' is printed.", 'The chapter emphasizes the importance of checking for the overflow condition before insertion.']}, {'end': 637.129, 'start': 416.558, 'title': 'Queue operations explanation', 'summary': 'Explains the operations of inserting and deleting elements in a queue, including handling of empty and full queues and the process of inserting and deleting elements, emphasizing the incrementing of front and rear pointers and the insertion of data into the queue.', 'duration': 220.571, 'highlights': ['The chapter explains the operations of inserting and deleting elements in a queue, including handling of empty and full queues and the process of inserting and deleting elements, emphasizing the incrementing of front and rear pointers and the insertion of data into the queue.', 'The function NQ is described, where it is shown how to insert elements into the queue, with the explanation of different scenarios such as an empty queue, inserting elements when the queue is not full, and the process of incrementing the rear pointer to insert data into the queue.', 'The function DQ is briefly mentioned, indicating that it is used to delete elements from the queue, without further elaboration on the specific cases or scenarios for deletion.']}], 'duration': 298.148, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/YqrFeU90Coo/pics/YqrFeU90Coo338981.jpg', 'highlights': ['The array is utilized for implementing a queue data structure, with both front and rear initially pointing to minus 1.', 'The chapter emphasizes the importance of checking for the overflow condition before insertion.', 'The chapter explains the operations of inserting and deleting elements in a queue, including handling of empty and full queues and the process of inserting and deleting elements, emphasizing the incrementing of front and rear pointers and the insertion of data into the queue.']}, {'end': 953.118, 'segs': [{'end': 758.657, 'src': 'heatmap', 'start': 648.792, 'weight': 0, 'content': [{'end': 652.053, 'text': 'this is the condition of empty queue, right in that case.', 'start': 648.792, 'duration': 3.261}, {'end': 659.176, 'text': 'here simply you can print what list is empty or you can say under flow condition now.', 'start': 652.053, 'duration': 7.123}, {'end': 669.525, 'text': 'else if when both front and rear are pointing to the same index this thing also we have discussed clearly in detail in the previous video.', 'start': 659.176, 'duration': 10.349}, {'end': 672.226, 'text': 'so you should check out that video first of all.', 'start': 669.525, 'duration': 2.701}, {'end': 677.09, 'text': 'suppose i have called dq function two times and dq means i have deleted this.', 'start': 672.226, 'duration': 4.864}, {'end': 679.932, 'text': 'i have deleted this after deleting these two.', 'start': 677.09, 'duration': 2.842}, {'end': 687.117, 'text': 'front would point to here and rear is also pointing to here means both front and rear are two.', 'start': 679.932, 'duration': 7.185}, {'end': 689.779, 'text': 'it means there is only one element in the queue.', 'start': 687.117, 'duration': 2.662}, {'end': 702.065, 'text': 'so here, if front equal to equal to rear, it means there is only one element and after deleting this element, this q will be empty, right.', 'start': 690.339, 'duration': 11.726}, {'end': 710.629, 'text': 'so here what you will write, you will set both front and rear equal to minus 1, because this is the condition we have taken for empty q,', 'start': 702.065, 'duration': 8.564}, {'end': 715.291, 'text': 'for showing the empty q front is equal to minus 1 rear equal to minus 1 right.', 'start': 710.629, 'duration': 4.662}, {'end': 716.752, 'text': "so that's it now.", 'start': 715.291, 'duration': 1.461}, {'end': 719.947, 'text': 'Third case may be this case.', 'start': 717.825, 'duration': 2.122}, {'end': 726.092, 'text': 'Q is not empty and there is more than one element in the Q.', 'start': 720.687, 'duration': 5.405}, {'end': 730.035, 'text': 'In that case what you will do? Suppose we have three elements in the Q.', 'start': 726.092, 'duration': 3.943}, {'end': 733.818, 'text': 'Now simply you will do what? Front plus plus.', 'start': 730.035, 'duration': 3.783}, {'end': 736.881, 'text': 'Here I can write front plus plus.', 'start': 734.639, 'duration': 2.242}, {'end': 744.872, 'text': 'because dq operation can be performed on the end, that is front.', 'start': 738.089, 'duration': 6.783}, {'end': 747.193, 'text': 'we can delete data from the front only.', 'start': 744.872, 'duration': 2.321}, {'end': 748.273, 'text': 'that is the rule of the queue.', 'start': 747.193, 'duration': 1.08}, {'end': 752.735, 'text': 'you have to take care of these rules, right because we are implementing here q.', 'start': 748.273, 'duration': 4.462}, {'end': 757.437, 'text': 'so you have to enforce these rules here, right.', 'start': 752.735, 'duration': 4.702}, {'end': 758.657, 'text': 'so front plus plus.', 'start': 757.437, 'duration': 1.22}], 'summary': 'Explained conditions for empty and non-empty queues, including specific scenarios and actions to take, with illustrative examples.', 'duration': 28.622, 'max_score': 648.792, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/YqrFeU90Coo/pics/YqrFeU90Coo648792.jpg'}, {'end': 953.118, 'src': 'heatmap', 'start': 900.746, 'weight': 1, 'content': [{'end': 902.807, 'text': 'so front and rear equal to minus 1.', 'start': 900.746, 'duration': 2.061}, {'end': 907.269, 'text': 'we will both set these front and rear equal to minus 1.', 'start': 902.807, 'duration': 4.462}, {'end': 908.81, 'text': 'both will point here.', 'start': 907.269, 'duration': 1.541}, {'end': 910.771, 'text': 'it means this is also now garbage value.', 'start': 908.81, 'duration': 1.961}, {'end': 913.473, 'text': "we don't have anything in the queue right.", 'start': 910.771, 'duration': 2.702}, {'end': 917.224, 'text': 'So this is how we are going to enqueue and dequeue the data.', 'start': 914.383, 'duration': 2.841}, {'end': 919.585, 'text': 'Now we will see the coding for display and peak function.', 'start': 917.264, 'duration': 2.321}, {'end': 924.087, 'text': 'Now at some point of time in queue I have 2, 5 and minus 1 right.', 'start': 920.005, 'duration': 4.082}, {'end': 929.069, 'text': 'After these enqueue function now I want to display this data whatever the value in the queue.', 'start': 924.447, 'duration': 4.622}, {'end': 931.049, 'text': 'So now I will define the display function.', 'start': 929.549, 'duration': 1.5}, {'end': 933.47, 'text': 'First of all you will check if the queue is empty.', 'start': 931.189, 'duration': 2.281}, {'end': 937.372, 'text': 'In that case obviously there is nothing to display in the queue.', 'start': 933.49, 'duration': 3.882}, {'end': 939.032, 'text': 'So what is that condition??', 'start': 937.852, 'duration': 1.18}, {'end': 949.176, 'text': 'You will write if front equal to equal to minus 1 and rear equal to equal to minus 1, in that case here you will print what q is empty right.', 'start': 939.413, 'duration': 9.763}, {'end': 953.118, 'text': 'else now we will print this data.', 'start': 949.176, 'duration': 3.942}], 'summary': 'Enqueue and dequeue the data, then display the queue content.', 'duration': 42.347, 'max_score': 900.746, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/YqrFeU90Coo/pics/YqrFeU90Coo900746.jpg'}], 'start': 637.129, 'title': 'Implementing and operating queue data structure', 'summary': 'Covers implementing a queue data structure, discussing conditions for an empty queue, handling single and multiple element queues, and the rule for deleting data from the front. it also explains the enqueue and dequeue operations in a queue, demonstrating the process with specific examples and addressing the handling of empty and non-empty queues.', 'chapters': [{'end': 785.385, 'start': 637.129, 'title': 'Implementing queue data structure', 'summary': 'Covers implementing a queue data structure, discussing conditions for an empty queue, handling single and multiple element queues, and the rule for deleting data from the front.', 'duration': 148.256, 'highlights': ['The rule for deleting data from the front in a queue is enforced by incrementing the front pointer, which signifies the deletion of an element, and the garbage value in the previous front position is ignored for future access.', 'In the case of a queue with only one element, both the front and rear pointers are set to -1 after deleting the element, indicating an empty queue.', 'The condition for an empty queue is checked by verifying if both front and rear pointers are equal to -1.']}, {'end': 953.118, 'start': 785.385, 'title': 'Queue enqueue and dequeue operations', 'summary': 'Explains the enqueue and dequeue operations in a queue, demonstrating the process with specific examples and addressing the handling of empty and non-empty queues.', 'duration': 167.733, 'highlights': ['The chapter explains the enqueue and dequeue operations in a queue The chapter focuses on explaining the fundamental enqueue and dequeue operations in a queue data structure.', 'demonstrating the process with specific examples Specific examples are provided to illustrate the process of enqueue and dequeue operations, aiding in better understanding.', 'addressing the handling of empty and non-empty queues The chapter addresses the specific handling of both empty and non-empty queues, providing insights into different scenarios.']}], 'duration': 315.989, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/YqrFeU90Coo/pics/YqrFeU90Coo637129.jpg', 'highlights': ['The rule for deleting data from the front in a queue is enforced by incrementing the front pointer, signifying the deletion of an element.', 'The condition for an empty queue is checked by verifying if both front and rear pointers are equal to -1.', 'The chapter explains the fundamental enqueue and dequeue operations in a queue data structure.', 'Specific examples are provided to illustrate the process of enqueue and dequeue operations, aiding in better understanding.']}, {'end': 1377.301, 'segs': [{'end': 978.444, 'src': 'embed', 'start': 953.118, 'weight': 2, 'content': [{'end': 959.439, 'text': 'see, every time i use while loop when you are traversing the list or anything, or you are displaying the content.', 'start': 953.118, 'duration': 6.321}, {'end': 962.34, 'text': 'but someone asked me why all the youtubers use while loop.', 'start': 959.439, 'duration': 2.901}, {'end': 964.461, 'text': "so in this video i'll use for loop.", 'start': 962.34, 'duration': 2.121}, {'end': 966.961, 'text': "fine, so i'll display using for loop.", 'start': 964.461, 'duration': 2.5}, {'end': 969.182, 'text': 'so for that case else.', 'start': 966.961, 'duration': 2.221}, {'end': 972.043, 'text': 'now, obviously you have to take a variable i.', 'start': 969.182, 'duration': 2.861}, {'end': 978.444, 'text': 'so you have to declare that variable i here in the display function, right, otherwise it will give you error.', 'start': 972.043, 'duration': 6.401}], 'summary': 'Demonstrating the use of for loop in displaying content instead of while loop.', 'duration': 25.326, 'max_score': 953.118, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/YqrFeU90Coo/pics/YqrFeU90Coo953118.jpg'}, {'end': 1109.334, 'src': 'embed', 'start': 1080.603, 'weight': 0, 'content': [{'end': 1081.924, 'text': 'Rear plus 1 is 3.', 'start': 1080.603, 'duration': 1.321}, {'end': 1083.005, 'text': 'Yes condition is true.', 'start': 1081.924, 'duration': 1.081}, {'end': 1086.448, 'text': 'Again printf q of 2 that is minus 1 would be printed.', 'start': 1083.205, 'duration': 3.243}, {'end': 1087.629, 'text': 'I plus plus.', 'start': 1086.968, 'duration': 0.661}, {'end': 1088.91, 'text': 'Now I becomes 3.', 'start': 1087.689, 'duration': 1.221}, {'end': 1091.012, 'text': 'So I is here now.', 'start': 1088.91, 'duration': 2.102}, {'end': 1092.012, 'text': '3 less than 3.', 'start': 1091.032, 'duration': 0.98}, {'end': 1093.173, 'text': 'No condition is not true.', 'start': 1092.012, 'duration': 1.161}, {'end': 1095.395, 'text': 'So we are not going to enter into this loop.', 'start': 1093.554, 'duration': 1.841}, {'end': 1096.856, 'text': 'Now exit from this loop.', 'start': 1095.775, 'duration': 1.081}, {'end': 1101.772, 'text': 'Right So the output is 2, 5 and minus 1.', 'start': 1097.657, 'duration': 4.115}, {'end': 1105.693, 'text': 'right. so this is what our display function now, the peak function.', 'start': 1101.772, 'duration': 3.921}, {'end': 1107.334, 'text': 'how you will write that coding.', 'start': 1105.693, 'duration': 1.641}, {'end': 1109.334, 'text': 'this is very simple.', 'start': 1107.334, 'duration': 2}], 'summary': 'The output of the code is 2, 5, and -1, demonstrating the display function and the simplicity of writing the coding for the peak function.', 'duration': 28.731, 'max_score': 1080.603, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/YqrFeU90Coo/pics/YqrFeU90Coo1080603.jpg'}, {'end': 1141.129, 'src': 'heatmap', 'start': 1107.334, 'weight': 0.777, 'content': [{'end': 1109.334, 'text': 'this is very simple.', 'start': 1107.334, 'duration': 2}, {'end': 1113.696, 'text': 'we are just checking what the value here at the front of the queue.', 'start': 1109.334, 'duration': 4.362}, {'end': 1117.997, 'text': 'what is that value right without removing that value in peak.', 'start': 1113.696, 'duration': 4.301}, {'end': 1122.018, 'text': 'also, you can write down this condition for checking the empty queue right.', 'start': 1117.997, 'duration': 4.021}, {'end': 1123.439, 'text': 'i guess you can write down this condition.', 'start': 1122.018, 'duration': 1.421}, {'end': 1129.1, 'text': "i'm not writing this in else part what you will write now if, condition now, the queue is not empty.", 'start': 1123.439, 'duration': 5.661}, {'end': 1133.823, 'text': 'in that case you have to print that data.', 'start': 1129.1, 'duration': 4.723}, {'end': 1136.265, 'text': 'fine the data at the front.', 'start': 1133.823, 'duration': 2.442}, {'end': 1138.847, 'text': 'so simply you will print here.', 'start': 1136.265, 'duration': 2.582}, {'end': 1141.129, 'text': 'write printf percentage d.', 'start': 1138.847, 'duration': 2.282}], 'summary': 'Checking value at the front of the queue and printing the data.', 'duration': 33.795, 'max_score': 1107.334, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/YqrFeU90Coo/pics/YqrFeU90Coo1107334.jpg'}, {'end': 1202.93, 'src': 'embed', 'start': 1176.233, 'weight': 1, 'content': [{'end': 1179.854, 'text': 'if you will print the data, then it would print 2 after that.', 'start': 1176.233, 'duration': 3.621}, {'end': 1187.615, 'text': 'if you will call this peak, then it would print 5, because after 1 dq the front would be pointing to here front plus, plus,', 'start': 1179.854, 'duration': 7.761}, {'end': 1190.076, 'text': 'and now q is this one and the front of q is 5.', 'start': 1187.615, 'duration': 2.461}, {'end': 1192.496, 'text': 'so now this would display 5.', 'start': 1190.076, 'duration': 2.42}, {'end': 1197.045, 'text': 'display function would display 5 and minus 1, 5 and minus 1.', 'start': 1192.496, 'duration': 4.549}, {'end': 1199.987, 'text': 'So this is how we can implement a queue using arrays right?', 'start': 1197.045, 'duration': 2.942}, {'end': 1201.789, 'text': 'But here the problem is.', 'start': 1200.308, 'duration': 1.481}, {'end': 1202.93, 'text': 'the drawback is.', 'start': 1201.789, 'duration': 1.141}], 'summary': 'Implementing a queue using arrays can display 5 with a drawback.', 'duration': 26.697, 'max_score': 1176.233, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/YqrFeU90Coo/pics/YqrFeU90Coo1176233.jpg'}, {'end': 1339.375, 'src': 'embed', 'start': 1306.665, 'weight': 4, 'content': [{'end': 1311.105, 'text': 'Just you have to update a little bit in your NQ function and DQ function.', 'start': 1306.665, 'duration': 4.44}, {'end': 1315.526, 'text': 'You cannot simply do front plus plus in DQ and rear plus plus in NQ.', 'start': 1311.406, 'duration': 4.12}, {'end': 1327.989, 'text': 'You have to modify that thing a little bit, right? Rather than rear plus plus, what you will do? Rear plus one mode N.', 'start': 1316.187, 'duration': 11.802}, {'end': 1330.03, 'text': 'N means size of this one, that is five.', 'start': 1327.989, 'duration': 2.041}, {'end': 1331.15, 'text': 'Now in this case, see.', 'start': 1330.37, 'duration': 0.78}, {'end': 1337.333, 'text': 'Rear is 4, right? 4 plus 1.', 'start': 1333.208, 'duration': 4.125}, {'end': 1339.375, 'text': 'Mode and value is 5.', 'start': 1337.333, 'duration': 2.042}], 'summary': 'Update nq and dq functions to modify rear and front pointers accordingly based on a given size of 5.', 'duration': 32.71, 'max_score': 1306.665, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/YqrFeU90Coo/pics/YqrFeU90Coo1306665.jpg'}, {'end': 1377.301, 'src': 'embed', 'start': 1368.053, 'weight': 3, 'content': [{'end': 1371.596, 'text': 'this is how you can overcome that drawback of this queue.', 'start': 1368.053, 'duration': 3.543}, {'end': 1375.279, 'text': 'so now, in next video, we will see how to implement a queue using linked list.', 'start': 1371.596, 'duration': 3.683}, {'end': 1376.32, 'text': "so i'll see you in the next video.", 'start': 1375.279, 'duration': 1.041}, {'end': 1377.301, 'text': 'till then, bye, bye, take care.', 'start': 1376.32, 'duration': 0.981}], 'summary': 'Overcome queue drawbacks by implementing a linked list. next video will cover implementation.', 'duration': 9.248, 'max_score': 1368.053, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/YqrFeU90Coo/pics/YqrFeU90Coo1368053.jpg'}], 'start': 953.118, 'title': 'For loop display function and implementing queue using arrays', 'summary': 'Demonstrates the use of a for loop in the display function to traverse and print the content of a list, showcasing the step-by-step process and the output of the function. additionally, it explains how to implement a queue using arrays, including displaying the front, handling full queue, and overcoming the drawback with circular queue, with emphasis on modifying nq and dq functions for circular queue implementation.', 'chapters': [{'end': 1105.693, 'start': 953.118, 'title': 'For loop display function', 'summary': 'Demonstrates the use of a for loop in the display function to traverse and print the content of a list, showcasing the step-by-step process and the output of the function.', 'duration': 152.575, 'highlights': ['The display function showcases the use of a for loop to print the content of a list, demonstrating the step-by-step process of traversing and printing the data, resulting in the output of 2, 5, and -1.', 'The video addresses the question of why YouTubers use while loops by employing a for loop, providing a practical example and explanation of its usage in the context of displaying list content.']}, {'end': 1377.301, 'start': 1105.693, 'title': 'Implementing queue using arrays', 'summary': 'Explains how to implement a queue using arrays, including displaying the front, handling full queue, and overcoming the drawback with circular queue, with emphasis on modifying nq and dq functions for circular queue implementation.', 'duration': 271.608, 'highlights': ["The chapter explains displaying the front of the queue and printing the data at the front, such as displaying '2, 5, -1' using the display function.", 'The chapter details the drawback of a queue using arrays, where space is wasted due to the inability to insert data even when space is available, and introduces the concept of a circular queue to overcome this limitation.', "The chapter emphasizes modifying the NQ and DQ functions for circular queue implementation by using 'rear + 1 mod N' and 'front + 1 mod N' instead of 'rear++' and 'front++' respectively."]}], 'duration': 424.183, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/YqrFeU90Coo/pics/YqrFeU90Coo953118.jpg', 'highlights': ['The display function showcases the use of a for loop to print the content of a list, demonstrating the step-by-step process of traversing and printing the data, resulting in the output of 2, 5, and -1.', "The chapter explains displaying the front of the queue and printing the data at the front, such as displaying '2, 5, -1' using the display function.", 'The video addresses the question of why YouTubers use while loops by employing a for loop, providing a practical example and explanation of its usage in the context of displaying list content.', 'The chapter details the drawback of a queue using arrays, where space is wasted due to the inability to insert data even when space is available, and introduces the concept of a circular queue to overcome this limitation.', "The chapter emphasizes modifying the NQ and DQ functions for circular queue implementation by using 'rear + 1 mod N' and 'front + 1 mod N' instead of 'rear++' and 'front++' respectively."]}], 'highlights': ['The time complexity for nq and dq operation must be order of one, emphasizing the efficiency of the insertion and deletion operations in the queue.', 'Queue follows what FIFO rule first in first out. Emphasizes the FIFO rule, where the first element inserted into the queue is the first one to be removed.', 'Logical representation of a queue: insertion is possible from one end (rear) and deletion is possible from the other end (front). Explains the logical representation of a queue, highlighting the process of insertion and deletion from the rear and front ends respectively.', 'The use of macro definition for static memory allocation enables easy modification of the queue size and facilitates logical representation of the queue with values 1, 2, 3, 4, and 5.', 'The global declaration of front and rear variables allows for their use in each function, minimizing the need for repeated variable declaration within each function.', 'The chapter covers queue operations such as peak and dq functions, along with the global declaration of front and rear variables, and the use of static memory allocation with macro definition.', 'The array is utilized for implementing a queue data structure, with both front and rear initially pointing to minus 1.', 'The chapter emphasizes the importance of checking for the overflow condition before insertion.', 'The chapter explains the operations of inserting and deleting elements in a queue, including handling of empty and full queues and the process of inserting and deleting elements, emphasizing the incrementing of front and rear pointers and the insertion of data into the queue.', 'The rule for deleting data from the front in a queue is enforced by incrementing the front pointer, signifying the deletion of an element.', 'The condition for an empty queue is checked by verifying if both front and rear pointers are equal to -1.', 'The chapter explains the fundamental enqueue and dequeue operations in a queue data structure.', 'Specific examples are provided to illustrate the process of enqueue and dequeue operations, aiding in better understanding.', 'The display function showcases the use of a for loop to print the content of a list, demonstrating the step-by-step process of traversing and printing the data, resulting in the output of 2, 5, and -1.', "The chapter explains displaying the front of the queue and printing the data at the front, such as displaying '2, 5, -1' using the display function.", 'The video addresses the question of why YouTubers use while loops by employing a for loop, providing a practical example and explanation of its usage in the context of displaying list content.', 'The chapter details the drawback of a queue using arrays, where space is wasted due to the inability to insert data even when space is available, and introduces the concept of a circular queue to overcome this limitation.', "The chapter emphasizes modifying the NQ and DQ functions for circular queue implementation by using 'rear + 1 mod N' and 'front + 1 mod N' instead of 'rear++' and 'front++' respectively."]}