00:00Now the next question is why we can implement using a link list?
00:04This is an important question which has been asked in Microsoft in a few interviews.
00:08Now the implementation is very easy and very enjoyable.
00:12If you have a link list is good, not good, if you have a 7 out of 10 link lists,
00:17then it will not be difficult to do this question.
00:20It will be very easy to complete it.
00:23Let's assume that we have a link list which represents a queue.
00:26This is a queue to represent it.
00:28These are nodes which are stored in queue, 1, 2, 3, and all these nodes are stored.
00:36These nodes are stored in queue, 1, 2, 3, and all these nodes are stored in queue.
00:38Now the nodes will be one of our link list and one of our nodes will be the link list.
00:48Usually we will only store the head, but we will also store the tail.
01:21This is our queue.
01:22a queue, 2, and all these nodes are stored in queue.
01:35A queue here is a queue.
01:36One node will also store the tail.
02:05our new node
02:08head from front
02:10this head from here
02:12and point
02:14next
02:15next
02:16this node
02:18here
02:18if there is no pointer
02:23if there is no pointer
02:23it will be garbage collector
02:28one
02:28now
02:29linked list
02:32node
03:01node
03:03and then we will create a class to create a class to create a static class node
03:11node store the int type data with our next pointer
03:23this.data and this.next will be null
03:30so this is our node.
03:33this is the node class which we will create a whole node
03:35in our queue.
03:37here we will create a static node which we will create a name
03:44head.
03:45here we will create a static node which we will create a name
03:49which we will create a small node.
03:53this is our queue.
03:55this is empty when we are here and the tail are here.
04:01here we will create a condition.
04:02head is equal to equal to null
04:04and tail is equal to equal to null
04:08is empty condition is full
04:11condition is here no need
04:13because fixed size is not
04:15linked list under how many elements add
04:18add to our program allow
04:20limit is full
04:22you need to add
04:23node node node data
04:24add to the data
04:27is empty
04:27add function
04:29is full
04:31completely
04:32in fact
04:36add to the new node
04:42is equal to new node of data
04:45now check
04:46first time element
04:48first time element
04:50front
04:50point
04:51and rear
04:53head and tail
04:55same node
04:55point
04:56if head
04:58head is equal to null
04:59head is equal to
05:03tail
05:03equal to
05:05new node
05:06and here we can do return
05:08if we don't have another case
05:11if we don't have another case
05:12which we already have a link list
05:13exists
05:13and then we have a new node
05:15add to what we can do
05:17what we can do
05:17next
05:18we can store
05:20our new node
05:22value
05:22and tail
05:23store
05:24our new node
05:26value
05:26so tail
05:27what is
05:28tail
05:28new node
05:30value
05:30now
05:32this is our link list
05:34rear part
05:35remove function
05:36to talk about
05:36there is empty
05:37condition
05:38same
05:38and the other conditions
05:40we can store
05:41front
05:42we can store
05:43head
05:43and this
05:46front
05:46we can do
05:47return
05:48now
05:49now
05:49change
05:50we can do
05:51what we can do
06:27single element
06:28we can do
06:30we can do
06:33we can do
07:00we can do
07:02we can do
07:03we can do
07:11we can do
07:28change
07:28change
07:28change
07:28remove
07:32to
07:33head
07:34node
07:35change
07:36and
07:37peak
07:38head
07:39return
07:40and
07:40constant
07:41time
07:41to
07:41optimize
07:42implementation
07:43implementation
07:44two
07:44to
07:44the
07:44the
07:44the
07:44the
07:44the