1

00:00:01,050  -->  00:00:06,800
Not look at the Q&A phase which is also it Subang to face off collection.

2

00:00:06,840  -->  00:00:12,790
Jews are useful then we need to manipulate head and head being the first element whitetail.

3

00:00:12,840  -->  00:00:20,600
The last one on the last element is the element which got added most recently so elements that are in

4

00:00:20,640  -->  00:00:25,730
detail and also elements are removed or recruit from the head.

5

00:00:26,100  -->  00:00:30,690
When we say remote it means the element is actually removed from the queue.

6

00:00:31,020  -->  00:00:37,800
But when we say retrieved it means that the element head is simply written but not removed from the

7

00:00:37,800  -->  00:00:41,860
queue and we need such Haddonfield manipulations.

8

00:00:41,940  -->  00:00:48,800
When we are modelling a fistful of photons far fast and fast out that is the element that gets added

9

00:00:48,810  -->  00:00:52,770
fast villi be the element that will be removed fast.

10

00:00:52,950  -->  00:00:59,400
So to use more fearful and in real world just like the regular use which we see everywhere.

11

00:00:59,790  -->  00:01:07,400
The person who stands first in the queue is the person who is so fast just can contain duplicates.

12

00:01:08,010  -->  00:01:15,840
Undergirding knows Huisken hobnails but generally most kewl implementations do not support noce recall

13

00:01:15,850  -->  00:01:23,430
that link list which is also a queue allows Null-A use but generally even if notes are allowed you should

14

00:01:23,440  -->  00:01:28,710
avoid inserting them unviewable the reason for that and the next slide.

15

00:01:28,760  -->  00:01:36,270
Note that unlike list interface queues or any off it some interfaces do not support indexed access to

16

00:01:36,270  -->  00:01:37,580
its elements.

17

00:01:37,580  -->  00:01:38,100
OK.

18

00:01:38,300  -->  00:01:42,490
And generally queues are less frequently used compatriots.

19

00:01:42,510  -->  00:01:47,610
It would of course depend on the software that you are developing but generally queues are less frequently

20

00:01:47,610  -->  00:01:50,150
used paperless.

21

00:01:50,420  -->  00:01:56,580
No limitation to methods that a queue inherits from collection it of is to also add new methods that

22

00:01:56,580  -->  00:02:03,840
are specific to head and daily manipulations on these new methods are supported in two forms as indicated

23

00:02:03,900  -->  00:02:05,640
by the columns in this table.

24

00:02:06,030  -->  00:02:12,270
One of them throws an exception if an operation fails while the other returns a special value which

25

00:02:12,270  -->  00:02:14,680
could be either Null are false.

26

00:02:14,790  -->  00:02:20,120
So if an operation fails those methods can be done if they're not and are false.

27

00:02:20,130  -->  00:02:23,220
So to insert an element into the queue we can use either.

28

00:02:23,220  -->  00:02:25,120
I'd offer it then.

29

00:02:25,710  -->  00:02:31,010
So both methods are elements to the tail as elements are always added to it.

30

00:02:31,310  -->  00:02:37,910
On both methods return a true IF element can be successfully added But if the Q is a capacity to stick

31

00:02:37,910  -->  00:02:44,620
that Q Which means that the size is fixed then I'd mattered to an illegal state exception.

32

00:02:44,820  -->  00:02:48,870
If the element cannot be added as the queue is full.

33

00:02:48,870  -->  00:02:53,680
However if is full the often method which simply add and enforce.

34

00:02:53,770  -->  00:02:58,880
So for capacity to stick that gules it is preferred to use the offer a method when compared to the Add

35

00:02:58,890  -->  00:03:03,270
method as it does not do an exception Onsen bit it does for us.

36

00:03:03,480  -->  00:03:07,710
So you don't need to add runtime exception but can perform some ordinary action.

37

00:03:07,710  -->  00:03:15,660
If the matter was mixed both removing pool would be removed had the element of the queue is empty then

38

00:03:15,710  -->  00:03:20,980
removed an exception well-poised would return a null value rather than false.

39

00:03:21,120  -->  00:03:22,650
OK so just keep that in mind.

40

00:03:22,650  -->  00:03:25,440
It would be done in non-value rather than false.

41

00:03:25,440  -->  00:03:31,590
Now earlier we said that even if a particular Q implementation accepts a null value we should not insert

42

00:03:31,590  -->  00:03:33,500
null on that was that you do.

43

00:03:33,630  -->  00:03:37,000
That's like point north Fullerton's or not.

44

00:03:37,230  -->  00:03:43,350
It would not be clear whether the head element is not or whether the Q itself is empty.

45

00:03:43,350  -->  00:03:48,640
Right on Finally element and Biek are inspection methods.

46

00:03:48,810  -->  00:03:53,810
That is to simply written the handling but will not remove it from the queue.

47

00:03:54,150  -->  00:03:58,690
Once again if the queue is M-B element method would throw an exception.

48

00:03:58,700  -->  00:04:02,480
Well peek would read and not the value.

49

00:04:02,490  -->  00:04:09,180
Now let's look at DEC which is a sub interface argue because simply shopfront double and Q Which means

50

00:04:09,180  -->  00:04:14,660
that elements can be added and removed at both ends of the queue with you.

51

00:04:14,670  -->  00:04:20,530
Elements could be added only at the remoted header as it is a queue.

52

00:04:20,650  -->  00:04:26,060
Of course Murdo's fearful but additionally it can also mortal a little bit stands apart.

53

00:04:26,070  -->  00:04:32,190
Last In First Out That is the element that got added last would be the element that could be removed

54

00:04:32,190  -->  00:04:32,950
first.

55

00:04:33,000  -->  00:04:38,110
That is the element that got added most recently is the element that will be removed first.

56

00:04:38,160  -->  00:04:41,040
Stocks exhibit default behavior.

57

00:04:41,100  -->  00:04:46,910
Recall that GBM uses a stack for keeping clock off method invocations.

58

00:04:46,930  -->  00:04:52,320
There is actually a legacy class called stock and if you recall an introductory lesson and this chapter

59

00:04:52,680  -->  00:04:57,790
we saved the dollar docs recommend using an array rather than a stack.

60

00:04:58,090  -->  00:05:05,890
Ok I stock because legacy or not it will be discussed next on and dumps of DEC implementations.

61

00:05:05,910  -->  00:05:09,260
Dick is the most commonly used implementation.

62

00:05:09,360  -->  00:05:15,270
Also as we've discussed in the link Lawson a linked list can also act as a deck in addition to being

63

00:05:15,370  -->  00:05:23,400
a list and there are also concurrent link back and link blocking deck both of which are related to concurrency

64

00:05:24,020  -->  00:05:27,880
So we may look at them later but not for now.

65

00:05:28,770  -->  00:05:35,970
Now let's consider this Dec illustration which has had it not since I don't recall operations can be

66

00:05:35,970  -->  00:05:37,370
performed on either.

67

00:05:37,380  -->  00:05:44,750
And DEC introduces the notion of first and last their first got response with the end of the present

68

00:05:44,750  -->  00:05:45,530
head.

69

00:05:45,550  -->  00:05:48,760
Why Lascar response to the present state.

70

00:05:48,990  -->  00:05:54,270
So the method specific to adding or removing elements to both first and last.

71

00:05:54,340  -->  00:05:56,580
Unless you look at them.

72

00:05:57,290  -->  00:05:59,320
Let's look at methods that deal with the.

73

00:05:59,350  -->  00:06:07,830
And that represents last since Dec extends do you still how I an offer on that it also meant that I

74

00:06:07,870  -->  00:06:14,500
had lost an offer last under exactly identical to IDE and offer.

75

00:06:14,520  -->  00:06:20,310
Next we have removed last and last with simply remove the last elements.

76

00:06:20,310  -->  00:06:26,520
Just note that like in the case of Q Dick also supports the two versions of methods where one Roshan's

77

00:06:26,520  -->  00:06:31,770
was an exception but the other returns a special value like false on them.

78

00:06:31,770  -->  00:06:36,390
Finally there are also the inspection methods get lost and be classed.

79

00:06:37,080  -->  00:06:42,790
So as you can see the methods are meaningfully named because we are dealing with the underlip doesn't

80

00:06:42,840  -->  00:06:43,520
last.

81

00:06:43,710  -->  00:06:45,350
OK that is there.

82

00:06:46,330  -->  00:06:48,350
And here are other methods that deal with the.

83

00:06:48,390  -->  00:06:54,890
And that represents just that is had on the first two sets of methods which are emphasized and read

84

00:06:55,200  -->  00:06:57,510
other ones which we saw earlier on.

85

00:06:57,510  -->  00:07:04,040
Third one is the remote first or point first which are same as remote on.

86

00:07:04,230  -->  00:07:09,950
Similarly get first and first or equivalent to element and Biek methods.

87

00:07:10,500  -->  00:07:16,040
Finally we all know how I'd first an offer first which allow adding an element at Heda.

88

00:07:16,410  -->  00:07:24,090
OK so they are adding an element at the end of that represents head which is fast Nordica also supports

89

00:07:24,090  -->  00:07:28,590
some additional methods whose names represent stack operations.

90

00:07:28,590  -->  00:07:32,420
So we help push on pop that push is same as at first.

91

00:07:32,460  -->  00:07:35,410
Well pop is same as removalist.

92

00:07:35,910  -->  00:07:37,240
Not that Pete.

93

00:07:37,260  -->  00:07:39,870
There is also a stack operation.

94

00:07:39,990  -->  00:07:43,620
So speak applies to both Q As well as stack.

95

00:07:43,620  -->  00:07:48,450
So by default for stack push pop on Biek are dealing with the.

96

00:07:48,480  -->  00:07:54,250
And that represents Hydra and it is just a job where designers decided to keep it.

97

00:07:54,720  -->  00:08:00,170
But you can see that if you want to you can also support stock behavior by using.

98

00:08:00,170  -->  00:08:09,120
I remember last and B-class methods which deal with the and that represents data but business just went

99

00:08:09,120  -->  00:08:13,480
with the and that represents head on so we also can go with that.

100

00:08:14,070  -->  00:08:17,820
So these are the code that's in Dec and we will look at some of them.

101

00:08:17,890  -->  00:08:21,360
I did ask them all that we will do in the next lesson.

102

00:08:21,640  -->  00:08:24,230
Underestimate that's like a remote first occurrence.

103

00:08:24,330  -->  00:08:30,810
Remove last appearance which D'Ken element as input and would remove the first and last occurrences

104

00:08:30,870  -->  00:08:32,200
of that element.

105

00:08:32,730  -->  00:08:33,630
So if needed.

106

00:08:33,660  -->  00:08:37,660
You can also make use of these methods.

107

00:08:37,710  -->  00:08:43,200
Kindly note that there are also something called blocking to use their operations going block.

108

00:08:43,550  -->  00:08:49,680
Could instance if we want to add an element into the queue and if the queue is full then the operation

109

00:08:49,740  -->  00:08:53,300
would wait until some space is available.

110

00:08:53,310  -->  00:09:00,570
Similarly every small operation would wait if the queue is empty and it was great until an element gets

111

00:09:00,600  -->  00:09:07,590
inserted will look at a blocking implementation in the concurrency chapter as it will be helpful for

112

00:09:07,700  -->  00:09:09,550
in direct communication.

113

00:09:09,940  -->  00:09:15,290
OK but as you can see there is one interface quite blocking queue which extends the queue interface

114

00:09:15,770  -->  00:09:20,970
and there is also blocking back which extends book deck as well as blocking queue.

115

00:09:21,180  -->  00:09:23,520
OK so you can look at the naming convention.

116

00:09:23,530  -->  00:09:26,370
It does grokking Beck because it extends rocking.

117

00:09:26,370  -->  00:09:32,610
You are also a dick so that's up with the Q interface under some interfaces.

118

00:09:32,610  -->  00:09:34,570
Next we will look at other Nick.

119

00:09:34,680  -->  00:09:35,120
Thank you
