title
4.8 Implementation of DEQUE using Circular Array | Data Structures Tutorials
description
In this lecture I have written C program to implement DEQUE(Double Ended Queue) using circular array. Discussed all the operations on deque data structure.
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/
#jennyslecture #dequeindatastructure #dsa
detail
{'title': '4.8 Implementation of DEQUE using Circular Array | Data Structures Tutorials', 'heatmap': [{'end': 288.089, 'start': 262.404, 'weight': 0.722}, {'end': 835.601, 'start': 766.076, 'weight': 0.86}, {'end': 1125.667, 'start': 1073.92, 'weight': 0.727}, {'end': 1232.518, 'start': 1137.294, 'weight': 0.766}, {'end': 1521.093, 'start': 1489.866, 'weight': 0.702}, {'end': 1692.85, 'start': 1668.189, 'weight': 0.777}, {'end': 1763.818, 'start': 1733.498, 'weight': 1}], 'summary': 'Tutorial covers the implementation of deque using circular arrays, discussing the concept, benefits, and operations of circular arrays, including insertion, deletion, handling edge cases, printing values, and implementing a dequeue using c programming with detailed examples and explanations.', 'chapters': [{'end': 113.064, 'segs': [{'end': 27.591, 'src': 'embed', 'start': 0.449, 'weight': 0, 'content': [{'end': 5.034, 'text': 'In this lecture we will see the implementation of DEQ using circular arrays.', 'start': 0.449, 'duration': 4.585}, {'end': 6.956, 'text': 'fine, see what is DEQ?', 'start': 5.034, 'duration': 1.922}, {'end': 13.323, 'text': 'I have already discussed in the previous video application of DEQ and types of DEQ, that is double ended queue.', 'start': 6.956, 'duration': 6.367}, {'end': 15.185, 'text': 'so you must check out that video first.', 'start': 13.323, 'duration': 1.862}, {'end': 17.487, 'text': 'I will provide you the link of that video in the side button.', 'start': 15.185, 'duration': 2.302}, {'end': 22.33, 'text': 'you can check out there right and you should know what is a circular array.', 'start': 17.487, 'duration': 4.843}, {'end': 24.491, 'text': 'what is the concept of circular array?', 'start': 22.33, 'duration': 2.161}, {'end': 27.591, 'text': 'see, we have discussed how to implement a queue.', 'start': 24.491, 'duration': 3.1}], 'summary': 'Lecture discusses deq implementation using circular arrays and queue implementation.', 'duration': 27.142, 'max_score': 0.449, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/WJres9mgiAk/pics/WJres9mgiAk449.jpg'}, {'end': 113.064, 'src': 'embed', 'start': 88.367, 'weight': 2, 'content': [{'end': 98.611, 'text': 'the circular array means, once you reach here, fine, then you can come back to here from end point to here.', 'start': 88.367, 'duration': 10.244}, {'end': 103.295, 'text': 'so logically you can represent this array, something like this.', 'start': 98.611, 'duration': 4.684}, {'end': 105.497, 'text': 'so this is logical representation of circular array.', 'start': 103.295, 'duration': 2.202}, {'end': 107.779, 'text': 'what is benefit of using circular array?', 'start': 105.497, 'duration': 2.282}, {'end': 108.72, 'text': 'what are the advantages?', 'start': 107.779, 'duration': 0.941}, {'end': 113.064, 'text': 'see, if you are using a linear array, not circular array, right, something like this.', 'start': 108.72, 'duration': 4.344}], 'summary': 'Circular arrays offer benefits over linear arrays, enabling efficient traversal and representation.', 'duration': 24.697, 'max_score': 88.367, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/WJres9mgiAk/pics/WJres9mgiAk88367.jpg'}], 'start': 0.449, 'title': 'Deq implementation using circular arrays', 'summary': 'Covers the implementation of deq using circular arrays, discussing the concept of circular arrays, the implementation of a circular queue, and the benefits of using a circular array over a linear array.', 'chapters': [{'end': 113.064, 'start': 0.449, 'title': 'Deq implementation using circular arrays', 'summary': 'Covers the implementation of deq using circular arrays, discussing the concept of circular arrays, the implementation of a circular queue, and the benefits of using a circular array over a linear array.', 'duration': 112.615, 'highlights': ['DEQ is a generalized version of queue data structure allowing insertion and deletion from both ends, making it a valuable data structure for various applications. DEQ is a generalized version of queue data structure allowing insertion and deletion from both ends, making it a valuable data structure for various applications.', 'The chapter emphasizes the importance of understanding the implementation of a circular queue, as it serves as the basis for comprehending the concept of implementing DEQ using circular arrays. The chapter emphasizes the importance of understanding the implementation of a circular queue, as it serves as the basis for comprehending the concept of implementing DEQ using circular arrays.', 'The advantages of using circular arrays over linear arrays are discussed, highlighting the benefit of representing the circular array logically and its practical advantages over linear arrays. The advantages of using circular arrays over linear arrays are discussed, highlighting the benefit of representing the circular array logically and its practical advantages over linear arrays.']}], 'duration': 112.615, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/WJres9mgiAk/pics/WJres9mgiAk449.jpg', 'highlights': ['DEQ is a generalized version of queue data structure allowing insertion and deletion from both ends, making it a valuable data structure for various applications.', 'The chapter emphasizes the importance of understanding the implementation of a circular queue, as it serves as the basis for comprehending the concept of implementing DEQ using circular arrays.', 'The advantages of using circular arrays over linear arrays are discussed, highlighting the benefit of representing the circular array logically and its practical advantages over linear arrays.']}, {'end': 726.188, 'segs': [{'end': 169.057, 'src': 'embed', 'start': 138.766, 'weight': 5, 'content': [{'end': 143.388, 'text': 'so in this case, see, rear is at the position 4, right.', 'start': 138.766, 'duration': 4.622}, {'end': 151.631, 'text': 'so if rear is equal to n minus 1, the q full condition is what rear equal to equal to n minus 1, right.', 'start': 143.388, 'duration': 8.243}, {'end': 153.592, 'text': 'in that case q is full.', 'start': 151.631, 'duration': 1.961}, {'end': 156.873, 'text': 'but here you can see we still have space left.', 'start': 153.592, 'duration': 3.281}, {'end': 162.376, 'text': 'but we cannot move from here to here because we are using a linear array, not a circular one.', 'start': 156.873, 'duration': 5.503}, {'end': 163.836, 'text': 'so this is what wastage of space.', 'start': 162.376, 'duration': 1.46}, {'end': 169.057, 'text': 'and if you use circular array, in that case you can move from here to here, fine.', 'start': 163.836, 'duration': 5.221}], 'summary': 'Linear array causes space wastage; circular array allows efficient movement.', 'duration': 30.291, 'max_score': 138.766, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/WJres9mgiAk/pics/WJres9mgiAk138766.jpg'}, {'end': 216.218, 'src': 'embed', 'start': 187.336, 'weight': 1, 'content': [{'end': 189.358, 'text': 'this is not a valid position or index.', 'start': 187.336, 'duration': 2.022}, {'end': 189.678, 'text': 'you can say.', 'start': 189.358, 'duration': 0.32}, {'end': 192.58, 'text': 'so how we will increment rear?', 'start': 190.399, 'duration': 2.181}, {'end': 193.601, 'text': 'something like this.', 'start': 192.58, 'duration': 1.021}, {'end': 202.084, 'text': 'see this thing we have already discussed in the video, that is implementation of circular q, that is rear plus 1 mode, and this is not divide,', 'start': 193.601, 'duration': 8.483}, {'end': 203.585, 'text': 'this is modulo operator.', 'start': 202.084, 'duration': 1.501}, {'end': 205.086, 'text': 'it will always give remainder.', 'start': 203.585, 'duration': 1.501}, {'end': 210.872, 'text': 'So at this point of time that rear is 4, it means 4 plus 1, that is 5..', 'start': 205.766, 'duration': 5.106}, {'end': 213.475, 'text': '5 modulo n value is 5.', 'start': 210.872, 'duration': 2.603}, {'end': 216.218, 'text': 'Size is 5 that is 5 mod 5.', 'start': 213.475, 'duration': 2.743}], 'summary': 'Implementation of circular queue with rear increment explained using modulo operator.', 'duration': 28.882, 'max_score': 187.336, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/WJres9mgiAk/pics/WJres9mgiAk187336.jpg'}, {'end': 290.431, 'src': 'heatmap', 'start': 262.404, 'weight': 0.722, 'content': [{'end': 265.766, 'text': 'means here both are pointing and here you can insert the data.', 'start': 262.404, 'duration': 3.362}, {'end': 269.676, 'text': 'suppose i have inserted two now to insert.', 'start': 265.766, 'duration': 3.91}, {'end': 273.019, 'text': 'suppose i am calling again insert rear from rear.', 'start': 269.676, 'duration': 3.343}, {'end': 275.861, 'text': 'i want to insert see, this is suppose i am taking rear end.', 'start': 273.019, 'duration': 2.842}, {'end': 280.064, 'text': 'this is front end right now.', 'start': 275.861, 'duration': 4.203}, {'end': 284.567, 'text': 'if you want to insert from rear, it means first of all you need to do it rear plus plus.', 'start': 280.064, 'duration': 4.503}, {'end': 288.089, 'text': 'so now rear is one and after that you can insert here.', 'start': 284.567, 'duration': 3.522}, {'end': 290.431, 'text': 'suppose i have inserted minus one.', 'start': 288.089, 'duration': 2.342}], 'summary': 'Explanation of inserting data from rear and front in a data structure.', 'duration': 28.027, 'max_score': 262.404, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/WJres9mgiAk/pics/WJres9mgiAk262404.jpg'}, {'end': 453.578, 'src': 'embed', 'start': 416.01, 'weight': 0, 'content': [{'end': 416.431, 'text': 'why so?', 'start': 416.01, 'duration': 0.421}, {'end': 418.412, 'text': 'because we are using a circular array.', 'start': 416.431, 'duration': 1.981}, {'end': 423.466, 'text': 'Right? It means see the situation is something like this.', 'start': 419.502, 'duration': 3.964}, {'end': 430.994, 'text': 'Now here we have 4, here we have minus 1, here we have 0 and rear is pointing to here and front is pointing to here.', 'start': 424.047, 'duration': 6.947}, {'end': 436.209, 'text': 'It means insert front means it should point to 4.', 'start': 432.307, 'duration': 3.902}, {'end': 438.05, 'text': 'It should go to 4.', 'start': 436.209, 'duration': 1.841}, {'end': 441.291, 'text': 'That is the concept of circular motion or circular array.', 'start': 438.05, 'duration': 3.241}, {'end': 453.578, 'text': 'Means if front is 0 and you are calling insert front at that point of time, front should become n minus 1.', 'start': 441.651, 'duration': 11.927}], 'summary': 'Circular array concept involves front pointing to n-1 for insert front.', 'duration': 37.568, 'max_score': 416.01, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/WJres9mgiAk/pics/WJres9mgiAk416010.jpg'}, {'end': 648.445, 'src': 'embed', 'start': 623.662, 'weight': 3, 'content': [{'end': 633.148, 'text': 'so in logical representation you can represent it something like this see here, the front is here and rear is here now, and there is nothing in this.', 'start': 623.662, 'duration': 9.486}, {'end': 635.109, 'text': 'only two elements are there now.', 'start': 633.148, 'duration': 1.961}, {'end': 641.503, 'text': 'if you do, if you delete from rear, then here is not minus 1 index.', 'start': 635.109, 'duration': 6.394}, {'end': 648.445, 'text': 'if you do rear minus, minus means logically, if you are doing this rear minus, minus, then it should point to here.', 'start': 641.503, 'duration': 6.942}], 'summary': 'Logical representation shows 2 elements; deleting from rear adjusts index.', 'duration': 24.783, 'max_score': 623.662, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/WJres9mgiAk/pics/WJres9mgiAk623662.jpg'}], 'start': 113.064, 'title': 'Circular queue operations', 'summary': 'Discusses the limitations of linear arrays for queue implementation and the concept of circular arrays to avoid wastage of space. it covers the implementation of circular queue operations including insertion, deletion, and handling of edge cases, with a detailed explanation of the code.', 'chapters': [{'end': 236.27, 'start': 113.064, 'title': 'Queue data structure', 'summary': 'Discusses the limitations of linear arrays for queue implementation, the concept of circular arrays to avoid wastage of space, and the implementation of circular queue operations, including insertion and rear incrementation.', 'duration': 123.206, 'highlights': ['The q full condition is when rear is equal to n minus 1 in linear array implementation, resulting in wastage of space.', 'The concept of circular arrays allows movement to the beginning of the array when rear reaches the end, preventing space wastage.', 'The implementation of circular queue involves incrementing rear using the formula (rear + 1) % n to insert elements and avoid pointing to invalid positions.']}, {'end': 726.188, 'start': 236.27, 'title': 'Circular queue operations', 'summary': 'Discusses the implementation of circular queue operations including insertion, deletion, and handling of edge cases, with an emphasis on the circular array concept and its practical application with a detailed explanation of the code.', 'duration': 489.918, 'highlights': ['The concept of circular queue operations including insertion, deletion, and handling of edge cases is thoroughly explained, with an emphasis on the circular array concept and its practical application.', 'The detailed explanation of insertion and deletion operations including front and rear pointer manipulations with clear examples and code representation.', 'The discussion on handling edge cases such as inserting and deleting elements at the front and rear ends of the circular queue, emphasizing the significance of circular motion and array boundary conditions.']}], 'duration': 613.124, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/WJres9mgiAk/pics/WJres9mgiAk113064.jpg', 'highlights': ['The concept of circular arrays allows movement to the beginning of the array when rear reaches the end, preventing space wastage.', 'The implementation of circular queue involves incrementing rear using the formula (rear + 1) % n to insert elements and avoid pointing to invalid positions.', 'The concept of circular queue operations including insertion, deletion, and handling of edge cases is thoroughly explained, with an emphasis on the circular array concept and its practical application.', 'The detailed explanation of insertion and deletion operations including front and rear pointer manipulations with clear examples and code representation.', 'The discussion on handling edge cases such as inserting and deleting elements at the front and rear ends of the circular queue, emphasizing the significance of circular motion and array boundary conditions.', 'The q full condition is when rear is equal to n minus 1 in linear array implementation, resulting in wastage of space.']}, {'end': 907.779, 'segs': [{'end': 766.076, 'src': 'embed', 'start': 727.248, 'weight': 1, 'content': [{'end': 735.275, 'text': 'so now, suppose, in the main function i am calling this enqueue operation in this order right enqueue first two times, then enqueue rear,', 'start': 727.248, 'duration': 8.027}, {'end': 738.978, 'text': 'then again enqueue first, right, and then i will display the content.', 'start': 735.275, 'duration': 3.703}, {'end': 742.981, 'text': 'now, see, i am taking the size of this array.', 'start': 738.978, 'duration': 4.003}, {'end': 746.223, 'text': 'is what five right, this is macro definition.', 'start': 742.981, 'duration': 3.242}, {'end': 753.268, 'text': 'and so suppose here i am taking the name of this is what dq only you can take any name, and the size is n, that is 5.', 'start': 746.223, 'duration': 7.045}, {'end': 758.991, 'text': 'so now, here also while enqueuing the data, obviously you must check the overflow condition.', 'start': 753.268, 'duration': 5.723}, {'end': 761.013, 'text': 'if the queue is full, then you cannot insert.', 'start': 758.991, 'duration': 2.022}, {'end': 763.254, 'text': 'it should return some valid message.', 'start': 761.013, 'duration': 2.241}, {'end': 764.875, 'text': 'now, what is that overflow condition?', 'start': 763.254, 'duration': 1.621}, {'end': 766.076, 'text': 'how to check that thing?', 'start': 764.875, 'duration': 1.201}], 'summary': 'Enqueue data in a queue of size 5, check for overflow condition.', 'duration': 38.828, 'max_score': 727.248, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/WJres9mgiAk/pics/WJres9mgiAk727248.jpg'}, {'end': 835.601, 'src': 'heatmap', 'start': 766.076, 'weight': 0.86, 'content': [{'end': 774.336, 'text': 'see if the situation is something like this in this case, here front is pointing and here, suppose, rear is pointing right.', 'start': 766.076, 'duration': 8.26}, {'end': 775.696, 'text': 'so we cannot do.', 'start': 774.336, 'duration': 1.36}, {'end': 777.716, 'text': 'if rear is n, minus 1, that is q is full.', 'start': 775.696, 'duration': 2.02}, {'end': 782.337, 'text': 'no, because here we are using circular array, we have space left.', 'start': 777.716, 'duration': 4.621}, {'end': 785.038, 'text': 'so now here we can insert, suppose, minus 1 and 7.', 'start': 782.337, 'duration': 2.701}, {'end': 790.319, 'text': 'so after inserting, here rear is pointing and here front is pointing right.', 'start': 785.038, 'duration': 5.281}, {'end': 792.319, 'text': 'now, see the q is full.', 'start': 790.319, 'duration': 2}, {'end': 794.399, 'text': 'so what condition you can write.', 'start': 792.319, 'duration': 2.08}, {'end': 797.38, 'text': 'see, you can check, front is 2, rear is 1.', 'start': 794.399, 'duration': 2.981}, {'end': 808.431, 'text': 'so can i write Front equal to rear plus 1 that is 2 and rear plus 1 that is 1 plus 1 is 2..', 'start': 797.38, 'duration': 11.051}, {'end': 809.572, 'text': 'It means Q is full.', 'start': 808.431, 'duration': 1.141}, {'end': 813.836, 'text': 'This is one condition but this is not the only condition for the Q is full.', 'start': 810.213, 'duration': 3.623}, {'end': 824.478, 'text': 'second case may be suppose here q is full, but at starting i have inserted here and after that i am calling only nq rear.', 'start': 814.736, 'duration': 9.742}, {'end': 826.299, 'text': 'i am just inserting from here.', 'start': 824.478, 'duration': 1.821}, {'end': 829.82, 'text': "so first of all here, then here, then here they're here.", 'start': 826.299, 'duration': 3.521}, {'end': 832.92, 'text': 'so now rear is pointing to here, front is pointing to here.', 'start': 829.82, 'duration': 3.1}, {'end': 835.601, 'text': 'that could also be a case right.', 'start': 832.92, 'duration': 2.681}], 'summary': 'Analyzing circular array for queue conditions and insertion.', 'duration': 69.525, 'max_score': 766.076, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/WJres9mgiAk/pics/WJres9mgiAk766076.jpg'}, {'end': 824.478, 'src': 'embed', 'start': 790.319, 'weight': 0, 'content': [{'end': 792.319, 'text': 'now, see the q is full.', 'start': 790.319, 'duration': 2}, {'end': 794.399, 'text': 'so what condition you can write.', 'start': 792.319, 'duration': 2.08}, {'end': 797.38, 'text': 'see, you can check, front is 2, rear is 1.', 'start': 794.399, 'duration': 2.981}, {'end': 808.431, 'text': 'so can i write Front equal to rear plus 1 that is 2 and rear plus 1 that is 1 plus 1 is 2..', 'start': 797.38, 'duration': 11.051}, {'end': 809.572, 'text': 'It means Q is full.', 'start': 808.431, 'duration': 1.141}, {'end': 813.836, 'text': 'This is one condition but this is not the only condition for the Q is full.', 'start': 810.213, 'duration': 3.623}, {'end': 824.478, 'text': 'second case may be suppose here q is full, but at starting i have inserted here and after that i am calling only nq rear.', 'start': 814.736, 'duration': 9.742}], 'summary': 'The queue is full when front is 2, rear is 1, and q is full, with additional conditions to consider.', 'duration': 34.159, 'max_score': 790.319, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/WJres9mgiAk/pics/WJres9mgiAk790319.jpg'}], 'start': 727.248, 'title': 'Queue and circular queue implementation', 'summary': 'Covers the implementation of queue data structure in c programming, including enqueue operation, macro definition, array size, overflow condition, and error handling. it also discusses the conditions for a circular queue to be full, emphasizing the need for a single condition to cover both scenarios.', 'chapters': [{'end': 766.076, 'start': 727.248, 'title': 'Queue data structure', 'summary': 'Discusses the implementation of a queue data structure in c programming, covering enqueue operation, macro definition, array size, overflow condition, and error handling.', 'duration': 38.828, 'highlights': ['The size of the array for the queue is defined as 5 using a macro.', 'Error handling for overflow condition while enqueuing data is emphasized, ensuring that the queue is not full before insertion.', 'Discussion about implementing the enqueue operation in the main function, including the order of enqueuing and displaying the content.']}, {'end': 907.779, 'start': 766.076, 'title': 'Circular queue full condition and implementation', 'summary': 'Discusses the conditions for a circular queue to be full, including cases where front equals rear plus 1 and when front equals 0 and rear equals n minus 1, and emphasizes the need for a single condition to cover both scenarios.', 'duration': 141.703, 'highlights': ['The condition for circular queue full can be when front equals rear plus 1 or when front equals 0 and rear equals n minus 1. This ensures that either of these conditions being satisfied indicates that the queue is full.', 'Emphasizes the need for a single condition to cover both scenarios, rather than separately writing the two conditions, to determine if the queue is full.']}], 'duration': 180.531, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/WJres9mgiAk/pics/WJres9mgiAk727248.jpg', 'highlights': ['The condition for circular queue full can be when front equals rear plus 1 or when front equals 0 and rear equals n minus 1. This ensures that either of these conditions being satisfied indicates that the queue is full.', 'Error handling for overflow condition while enqueuing data is emphasized, ensuring that the queue is not full before insertion.', 'Discussion about implementing the enqueue operation in the main function, including the order of enqueuing and displaying the content.', 'The size of the array for the queue is defined as 5 using a macro.', 'Emphasizes the need for a single condition to cover both scenarios, rather than separately writing the two conditions, to determine if the queue is full.']}, {'end': 1467.602, 'segs': [{'end': 936.648, 'src': 'embed', 'start': 908.579, 'weight': 0, 'content': [{'end': 910.82, 'text': 'now first of all check out the q full condition.', 'start': 908.579, 'duration': 2.241}, {'end': 914.142, 'text': 'if q is full, then obviously we cannot insert anything.', 'start': 910.82, 'duration': 3.322}, {'end': 915.823, 'text': 'so here what you can write.', 'start': 914.142, 'duration': 1.681}, {'end': 920.126, 'text': 'these two condition you should write here if this is the case, means q is full.', 'start': 915.823, 'duration': 4.303}, {'end': 923.568, 'text': 'or here you will write or this condition.', 'start': 920.126, 'duration': 3.442}, {'end': 928.142, 'text': 'if this condition is there, it means also q is full.', 'start': 924.56, 'duration': 3.582}, {'end': 929.743, 'text': 'but here i am writing what.', 'start': 928.142, 'duration': 1.601}, {'end': 932.385, 'text': 'or it means either condition.', 'start': 929.743, 'duration': 2.642}, {'end': 936.648, 'text': "it's not compulsory that these both conditions should be true.", 'start': 932.385, 'duration': 4.263}], 'summary': 'Check if queue is full before inserting, write conditions for full queue', 'duration': 28.069, 'max_score': 908.579, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/WJres9mgiAk/pics/WJres9mgiAk908579.jpg'}, {'end': 1057.387, 'src': 'embed', 'start': 1021.845, 'weight': 2, 'content': [{'end': 1025.067, 'text': 'because here both front and rear are minus 1 at starting.', 'start': 1021.845, 'duration': 3.222}, {'end': 1032.752, 'text': 'so i will set both front and rear to 0 and then at dq 0 means at this index i will insert this 2.', 'start': 1025.067, 'duration': 7.685}, {'end': 1036.896, 'text': 'now again, if you call nq front, this condition is not true.', 'start': 1032.752, 'duration': 4.144}, {'end': 1038.718, 'text': 'this condition is also not true.', 'start': 1036.896, 'duration': 1.822}, {'end': 1039.838, 'text': 'now, what you will do.', 'start': 1038.718, 'duration': 1.12}, {'end': 1041.56, 'text': 'see, we have discussed it with that example.', 'start': 1039.838, 'duration': 1.722}, {'end': 1045.733, 'text': 'front is here and rear is also here.', 'start': 1042.952, 'duration': 2.781}, {'end': 1057.387, 'text': 'now again, if you are calling nq front, means you will not do front plus plus what you will do If front is 0, then see,', 'start': 1045.733, 'duration': 11.654}], 'summary': 'Rear and front start at -1, both set to 0. insert 2 at index 0.', 'duration': 35.542, 'max_score': 1021.845, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/WJres9mgiAk/pics/WJres9mgiAk1021845.jpg'}, {'end': 1125.667, 'src': 'heatmap', 'start': 1073.92, 'weight': 0.727, 'content': [{'end': 1082.796, 'text': 'So now else if front equal to equal to 0 then first of all you will set front equal to n minus 1.', 'start': 1073.92, 'duration': 8.876}, {'end': 1085.777, 'text': 'Means now front is n is what? 5.', 'start': 1082.796, 'duration': 2.981}, {'end': 1087.858, 'text': 'So now front is 4.', 'start': 1085.777, 'duration': 2.081}, {'end': 1089.038, 'text': 'So now front is here.', 'start': 1087.858, 'duration': 1.18}, {'end': 1091.339, 'text': 'And now here I can insert.', 'start': 1089.999, 'duration': 1.34}, {'end': 1097.361, 'text': 'So here you can simply write after that dq front equal to x.', 'start': 1091.419, 'duration': 5.942}, {'end': 1100.662, 'text': 'So in else part simply do front minus minus.', 'start': 1097.361, 'duration': 3.301}, {'end': 1101.823, 'text': 'Front minus minus.', 'start': 1100.782, 'duration': 1.041}, {'end': 1106.026, 'text': 'Obviously while inserting from front we do front minus minus.', 'start': 1102.663, 'duration': 3.363}, {'end': 1107.868, 'text': 'These are some special cases.', 'start': 1106.487, 'duration': 1.381}, {'end': 1109.95, 'text': 'I have discussed all the special cases.', 'start': 1108.389, 'duration': 1.561}, {'end': 1119.82, 'text': 'Now remaining cases what? In all the remaining cases simply do front minus minus and here you can insert dqf is equal to x.', 'start': 1110.531, 'duration': 9.289}, {'end': 1125.667, 'text': 'So this is what NQ front operation right the definition of this operation right.', 'start': 1121.004, 'duration': 4.663}], 'summary': 'Explains front operation in a queue with special cases.', 'duration': 51.747, 'max_score': 1073.92, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/WJres9mgiAk/pics/WJres9mgiAk1073920.jpg'}, {'end': 1232.518, 'src': 'heatmap', 'start': 1137.294, 'weight': 0.766, 'content': [{'end': 1142.737, 'text': 'this is not true because here front equal to 0 and obviously we know front equal to 0 after inserting this 2..', 'start': 1137.294, 'duration': 5.443}, {'end': 1146.36, 'text': 'So now front becomes N minus 1 that is 4 and here you will insert this 5 right.', 'start': 1142.737, 'duration': 3.623}, {'end': 1151.726, 'text': 'so after calling these two, q is something like this, dq is something like this right.', 'start': 1147.341, 'duration': 4.385}, {'end': 1153.688, 'text': 'so now we are calling nq rear.', 'start': 1151.726, 'duration': 1.962}, {'end': 1156.831, 'text': 'now how to write down the definition of this operation?', 'start': 1153.688, 'duration': 3.143}, {'end': 1158.673, 'text': 'see here also.', 'start': 1156.831, 'duration': 1.842}, {'end': 1161.196, 'text': 'you need some variable to receive this value.', 'start': 1158.673, 'duration': 2.523}, {'end': 1163.041, 'text': 'that is minus 1.', 'start': 1161.196, 'duration': 1.845}, {'end': 1166.282, 'text': 'same here also, these two condition would be same.', 'start': 1163.041, 'duration': 3.241}, {'end': 1168.143, 'text': 'you will check q full condition.', 'start': 1166.282, 'duration': 1.861}, {'end': 1171.464, 'text': 'you will check for this q empty condition, right.', 'start': 1168.143, 'duration': 3.321}, {'end': 1173.124, 'text': "so i'm not going to write this condition.", 'start': 1171.464, 'duration': 1.66}, {'end': 1173.945, 'text': 'q full condition.', 'start': 1173.124, 'duration': 0.821}, {'end': 1180.567, 'text': 'you can, i guess you can, easily write down here this condition, that is, if this is the case, then write down q is full.', 'start': 1173.945, 'duration': 6.622}, {'end': 1192.271, 'text': 'else if if this condition, that is front equal to equal to minus one and rear equal to equal to minus one, you will set both front and rear to zero.', 'start': 1180.567, 'duration': 11.704}, {'end': 1202.845, 'text': 'obviously, and now here what you will write dq and in subscript rather than f, because we are inserting from rear, you will write rear,', 'start': 1193.482, 'duration': 9.363}, {'end': 1210.847, 'text': 'or you can say here i am taking r as equal to the value in x right now.', 'start': 1202.845, 'duration': 8.002}, {'end': 1218.592, 'text': 'now, next situation may be see something like this if rear is at this position, that is four.', 'start': 1212.489, 'duration': 6.103}, {'end': 1221.673, 'text': 'rear is four and front is at two.', 'start': 1218.592, 'duration': 3.081}, {'end': 1225.195, 'text': 'so here in this case you will insert from rear,', 'start': 1221.673, 'duration': 3.522}, {'end': 1232.518, 'text': 'but we cannot do rear plus plus right and it is not a q full condition because we are still left with two spaces.', 'start': 1225.195, 'duration': 7.323}], 'summary': 'Explaining queue operations with specific examples and conditions.', 'duration': 95.224, 'max_score': 1137.294, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/WJres9mgiAk/pics/WJres9mgiAk1137294.jpg'}, {'end': 1467.602, 'src': 'embed', 'start': 1441.314, 'weight': 3, 'content': [{'end': 1446.696, 'text': 'So for Q, full condition, either one condition, either this or this, should be true.', 'start': 1441.314, 'duration': 5.382}, {'end': 1447.777, 'text': 'This condition is true.', 'start': 1446.836, 'duration': 0.941}, {'end': 1453.059, 'text': 'So, control will enter into this statement and what would be printed Q is full.', 'start': 1448.137, 'duration': 4.922}, {'end': 1455.54, 'text': 'That is exactly you can see Q is full.', 'start': 1453.759, 'duration': 1.781}, {'end': 1461.139, 'text': 'right now we will see how to display this data of this dq.', 'start': 1456.496, 'duration': 4.643}, {'end': 1467.602, 'text': 'see, this is very simple and same coding as we have discussed in the implementation of a circular queue.', 'start': 1461.139, 'duration': 6.463}], 'summary': 'If the condition is true, q will be printed as full.', 'duration': 26.288, 'max_score': 1441.314, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/WJres9mgiAk/pics/WJres9mgiAk1441314.jpg'}], 'start': 908.579, 'title': 'Queue operations and circular queue insertion', 'summary': "Covers queue conditions, logical operators, and circular queue insertion process, emphasizing 'and' and 'or' conditions, special cases, circular movement, and queue fullness conditions with detailed examples and explanations.", 'chapters': [{'end': 956.921, 'start': 908.579, 'title': 'Queue conditions and operations', 'summary': "Discusses the conditions for a queue to be full or empty, and the corresponding logical operators used for evaluating these conditions, emphasizing the importance of considering both 'and' and 'or' conditions in determining the state of the queue.", 'duration': 48.342, 'highlights': ["The importance of considering both 'and' and 'or' conditions in determining the state of the queue, emphasizing that the queue is full only when both conditions are true.", 'The need to check if the queue is full before inserting any element, highlighting the necessity of evaluating the condition before insertion.', "The significance of the 'or' operator, illustrating that either condition being true results in the queue being full.", "The condition for the queue to be empty, indicated by the value of 'front' being equal to -1, emphasizing the necessity of this check to determine the empty state of the queue."]}, {'end': 1467.602, 'start': 956.921, 'title': 'Circular queue insertion', 'summary': 'Discusses the process of inserting elements into a circular queue, covering special cases such as setting front and rear pointers, circular movement, and conditions for queue fullness, with detailed examples and explanations.', 'duration': 510.681, 'highlights': ['The chapter covers special cases such as setting front and rear pointers with detailed examples and explanations.', 'It explains the circular movement concept and conditions for queue fullness, providing clear examples and scenarios.', 'The chapter discusses the process of inserting elements into a circular queue, emphasizing the handling of special cases and conditions for queue fullness.']}], 'duration': 559.023, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/WJres9mgiAk/pics/WJres9mgiAk908579.jpg', 'highlights': ["The importance of considering both 'and' and 'or' conditions in determining the state of the queue, emphasizing that the queue is full only when both conditions are true.", 'The need to check if the queue is full before inserting any element, highlighting the necessity of evaluating the condition before insertion.', 'The chapter covers special cases such as setting front and rear pointers with detailed examples and explanations.', 'It explains the circular movement concept and conditions for queue fullness, providing clear examples and scenarios.']}, {'end': 2196.095, 'segs': [{'end': 1521.093, 'src': 'heatmap', 'start': 1489.866, 'weight': 0.702, 'content': [{'end': 1494.629, 'text': 'so here also you can check the same condition for q empty, that is a front and rear equal to minus 1.', 'start': 1489.866, 'duration': 4.763}, {'end': 1496.01, 'text': 'then q is empty.', 'start': 1494.629, 'duration': 1.381}, {'end': 1497.431, 'text': 'in else part what you will write.', 'start': 1496.01, 'duration': 1.421}, {'end': 1498.972, 'text': 'you will write a while loop.', 'start': 1497.431, 'duration': 1.541}, {'end': 1500.574, 'text': 'i am simply writing that loop.', 'start': 1498.972, 'duration': 1.602}, {'end': 1514.41, 'text': 'while this i not equal to rear, till then you are going to print the value and how to increase this.', 'start': 1500.574, 'duration': 13.836}, {'end': 1519.032, 'text': 'i see at starting i is equal to f means i is here.', 'start': 1514.41, 'duration': 4.622}, {'end': 1521.093, 'text': 'i is equal to 3.', 'start': 1519.032, 'duration': 2.061}], 'summary': "Code checks if queue is empty and prints values in a while loop until 'i' equals 'rear'.", 'duration': 31.227, 'max_score': 1489.866, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/WJres9mgiAk/pics/WJres9mgiAk1489866.jpg'}, {'end': 1579.699, 'src': 'embed', 'start': 1546.048, 'weight': 0, 'content': [{'end': 1553.191, 'text': 'So how you will increase this i? This i should become i plus 1 mod n.', 'start': 1546.048, 'duration': 7.143}, {'end': 1554.232, 'text': 'You can say size of the array.', 'start': 1553.191, 'duration': 1.041}, {'end': 1568.904, 'text': 'Right? So now see after that after printing 7 i becomes i plus 1 that is i is 3, 3 plus 1 4, 4 mod n, n is 5.', 'start': 1555.987, 'duration': 12.917}, {'end': 1573.95, 'text': 'Now see it is not divide it is mod operator, modulo operator that will give you the remainder.', 'start': 1568.904, 'duration': 5.046}, {'end': 1575.876, 'text': 'Divide is not possible.', 'start': 1574.895, 'duration': 0.981}, {'end': 1577.177, 'text': 'So it would be 4.', 'start': 1575.936, 'duration': 1.241}, {'end': 1579.079, 'text': 'Now the i becomes 4.', 'start': 1577.177, 'duration': 1.902}, {'end': 1579.699, 'text': 'That is here.', 'start': 1579.079, 'duration': 0.62}], 'summary': 'Increment i by 1 using modulo operator, resulting in i=4.', 'duration': 33.651, 'max_score': 1546.048, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/WJres9mgiAk/pics/WJres9mgiAk1546048.jpg'}, {'end': 1697.312, 'src': 'heatmap', 'start': 1668.189, 'weight': 3, 'content': [{'end': 1670.291, 'text': 'because DQ rear is what 2.', 'start': 1668.189, 'duration': 2.102}, {'end': 1672.473, 'text': 'so at second index we have 0.', 'start': 1670.291, 'duration': 2.182}, {'end': 1673.914, 'text': 'then 0 would be printed.', 'start': 1672.473, 'duration': 1.441}, {'end': 1675.996, 'text': 'so this is how you can display the content of a DQ.', 'start': 1673.914, 'duration': 2.082}, {'end': 1680.467, 'text': 'now we will print the value, that is get front and get rear.', 'start': 1676.866, 'duration': 3.601}, {'end': 1683.348, 'text': 'after that we will see the dq operation.', 'start': 1680.467, 'duration': 2.881}, {'end': 1686.289, 'text': 'right that those are very simple.', 'start': 1683.348, 'duration': 2.941}, {'end': 1687.589, 'text': 'how you will print the value.', 'start': 1686.289, 'duration': 1.3}, {'end': 1689.149, 'text': 'suppose i am print.', 'start': 1687.589, 'duration': 1.56}, {'end': 1692.85, 'text': 'i want to print whatever the value at the front of the queue.', 'start': 1689.149, 'duration': 3.701}, {'end': 1694.671, 'text': 'so first of all you will check same.', 'start': 1692.85, 'duration': 1.821}, {'end': 1697.312, 'text': 'if q is empty, then nothing is there to print.', 'start': 1694.671, 'duration': 2.641}], 'summary': 'Demonstrates how to display and print content of a dq while explaining queue operations.', 'duration': 29.123, 'max_score': 1668.189, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/WJres9mgiAk/pics/WJres9mgiAk1668189.jpg'}, {'end': 1763.818, 'src': 'heatmap', 'start': 1733.498, 'weight': 1, 'content': [{'end': 1738.822, 'text': 'so in this case dq front means front value is 3.', 'start': 1733.498, 'duration': 5.324}, {'end': 1740.883, 'text': 'here, so 7 would be printed.', 'start': 1738.822, 'duration': 2.061}, {'end': 1743.666, 'text': 'dq rear rear value is 2, so 0 would be printed.', 'start': 1740.883, 'duration': 2.783}, {'end': 1745.75, 'text': 'Now we will see the DQ operation.', 'start': 1744.369, 'duration': 1.381}, {'end': 1750.512, 'text': 'So, after calling those NQ operation, the Q is something like this, right? This is the situation.', 'start': 1745.99, 'duration': 4.522}, {'end': 1751.913, 'text': 'Front is 3, rear is 2.', 'start': 1750.632, 'duration': 1.281}, {'end': 1754.194, 'text': 'Now, I am going to call DQ front.', 'start': 1751.913, 'duration': 2.281}, {'end': 1763.818, 'text': 'Now, the definition of DQ front would be what? See, first of all, we will check if there is nothing in the Q.', 'start': 1754.934, 'duration': 8.884}], 'summary': 'Demonstrating dq operation with front value of 3 and rear value of 2.', 'duration': 30.32, 'max_score': 1733.498, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/WJres9mgiAk/pics/WJres9mgiAk1733498.jpg'}, {'end': 1809.877, 'src': 'embed', 'start': 1783.032, 'weight': 1, 'content': [{'end': 1793.518, 'text': 'and what is that condition if both front and rear are pointing to the same index, means else if front equal to equal to rear?', 'start': 1783.032, 'duration': 10.486}, {'end': 1796.26, 'text': 'that thing we have already discussed earlier in this video with example.', 'start': 1793.518, 'duration': 2.742}, {'end': 1799.928, 'text': 'So there is only one element in the DQ.', 'start': 1797.225, 'duration': 2.703}, {'end': 1804.953, 'text': 'So after deleting that element, we know that this DQ would become empty.', 'start': 1800.228, 'duration': 4.725}, {'end': 1809.877, 'text': 'So simply you will set both front and rear equal to minus one.', 'start': 1804.993, 'duration': 4.884}], 'summary': "When there's only one element in the dq, both front and rear are set to -1 after deletion.", 'duration': 26.845, 'max_score': 1783.032, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/WJres9mgiAk/pics/WJres9mgiAk1783032.jpg'}], 'start': 1467.602, 'title': 'Printing values from front to rear and implementing a dequeue', 'summary': 'Discusses printing values from front to rear using a loop and modulo operation and implementing a dequeue using circular arrays, covering displaying content, operations, and edge cases.', 'chapters': [{'end': 1644.062, 'start': 1467.602, 'title': 'Printing values from front to rear', 'summary': 'Discusses how to print values from the front to the rear of a data structure using a loop and modulo operation, with examples of incrementing and checking conditions, ensuring that the index remains within the valid range.', 'duration': 176.46, 'highlights': ['The chapter explains the process of incrementing the index using the modulo operation to ensure that the index remains within the valid range, for example, when i becomes 4, i++ would result in 5, which is not a valid index, so i is increased using the formula i = (i + 1) % n.', 'It illustrates the process of incrementing the index using the modulo operation by using a specific example, where i becomes 4, and after adding 1 and taking modulo 5, the index becomes 4, ensuring that it remains within the valid range.', 'The chapter demonstrates the process of incrementing the index using the modulo operation by showing how, after printing 7, the index is increased using the formula i = (i + 1) % n, resulting in the index becoming 4, ensuring that it remains within the valid range.', 'It explains the process of incrementing the index using the modulo operation to ensure that the index remains within the valid range, for example, after printing 7, the index is increased using the formula i = (i + 1) % n, resulting in the index becoming 4, ensuring that it remains within the valid range.']}, {'end': 2196.095, 'start': 1644.062, 'title': 'Implementing a dequeue', 'summary': 'Explains how to implement a dequeue using circular arrays, covering topics such as displaying dequeue content, performing dequeue operations, and handling edge cases when deleting elements from the front and rear, with a specific focus on controlling pointers and index values.', 'duration': 552.033, 'highlights': ["The chapter explains how to display the content of a DQ, including printing the values at the front and rear, which are illustrated with specific examples like 'at second index we have 0' and 'front value is 3, rear value is 2.'", "Detailed explanation of the DQ front operation, covering scenarios such as an empty queue, a single element queue, and the process of resetting front and rear pointers after dequeuing, with specific guidance on pointer manipulation like 'if front equal to equal to n minus 1, then set front equal to 0.'", "Clear explanation of the DQ rear operation, addressing conditions for an empty queue, deleting from the rear, and handling index manipulation, such as 'if rear equal to 0, set rear equal to n minus 1.'"]}], 'duration': 728.493, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/WJres9mgiAk/pics/WJres9mgiAk1467602.jpg', 'highlights': ['The chapter explains the process of incrementing the index using the modulo operation to ensure that the index remains within the valid range.', "Detailed explanation of the DQ front operation, covering scenarios such as an empty queue, a single element queue, and the process of resetting front and rear pointers after dequeuing, with specific guidance on pointer manipulation like 'if front equal to equal to n minus 1, then set front equal to 0.'", 'The chapter demonstrates the process of incrementing the index using the modulo operation by showing how, after printing 7, the index is increased using the formula i = (i + 1) % n, resulting in the index becoming 4, ensuring that it remains within the valid range.', "The chapter explains how to display the content of a DQ, including printing the values at the front and rear, which are illustrated with specific examples like 'at second index we have 0' and 'front value is 3, rear value is 2.'"]}], 'highlights': ['The chapter emphasizes the importance of understanding the implementation of a circular queue, as it serves as the basis for comprehending the concept of implementing DEQ using circular arrays.', 'The advantages of using circular arrays over linear arrays are discussed, highlighting the benefit of representing the circular array logically and its practical advantages over linear arrays.', 'The concept of circular arrays allows movement to the beginning of the array when rear reaches the end, preventing space wastage.', 'The implementation of circular queue involves incrementing rear using the formula (rear + 1) % n to insert elements and avoid pointing to invalid positions.', 'The detailed explanation of insertion and deletion operations including front and rear pointer manipulations with clear examples and code representation.', 'The condition for circular queue full can be when front equals rear plus 1 or when front equals 0 and rear equals n minus 1. This ensures that either of these conditions being satisfied indicates that the queue is full.', 'Error handling for overflow condition while enqueuing data is emphasized, ensuring that the queue is not full before insertion.', "The importance of considering both 'and' and 'or' conditions in determining the state of the queue, emphasizing that the queue is full only when both conditions are true.", 'The need to check if the queue is full before inserting any element, highlighting the necessity of evaluating the condition before insertion.', 'The chapter explains the process of incrementing the index using the modulo operation to ensure that the index remains within the valid range.', "Detailed explanation of the DQ front operation, covering scenarios such as an empty queue, a single element queue, and the process of resetting front and rear pointers after dequeuing, with specific guidance on pointer manipulation like 'if front equal to equal to n minus 1, then set front equal to 0.'", 'The chapter demonstrates the process of incrementing the index using the modulo operation by showing how, after printing 7, the index is increased using the formula i = (i + 1) % n, resulting in the index becoming 4, ensuring that it remains within the valid range.', "The chapter explains how to display the content of a DQ, including printing the values at the front and rear, which are illustrated with specific examples like 'at second index we have 0' and 'front value is 3, rear value is 2.'"]}