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G5<5#&<"(3/@#H#+-(*($8*&?*+?(5>J0#>#&8*85/&-(*$(83#(/&#(G/+(83#(6*H*
LinkedList(<0*$$-(8+*<,$(A/83(83#(3#*?(*&?(83#(8*50(/G(*(05&,#?(05$8(/AD#<8(*$(58$(J+5H*8#(5&$8*&<#(H*+5*A0#$-(*$
500%$8+*8#?(A"(83#(8@/(A0%#(*++/@$(5&(83#(*A/H#(G5'%+#1
9/%(<*&(G5&?(*00(83#(>#83/?$(/G(83#(LinkedList(<0*$$(*$(@#00(*$(83#5+(?#8*50#?(?#$<+5J85/&$(*8
388J$BPP?/<$1/+*<0#1</>PD*H*$#P[P?/<$P*J5PD*H*P%850PN5&,#?N5$8138>01
`#<*%$#(58(5$(#*$"(8/(*<<#$$(*&?(%J?*8#(A/83(#&?$(/G(*(05&,#?(05$8-(in addition to(83#(</>>/&(>#83/?$(/G(83#(List
5&8#+G*<#-(83#(LinkedList(<0*$$(J+/H5?#$(83#(G/00/@5&'(>#83/?$(involving just the head or the tail(/G(*
LinkedListxEy(/AD#<8-(@3#+#(E(5$(83#('#&#+5<(8"J#(/G(83#(05$8(#0#>#&8$1
H/5?(addFirstOE(#R1(F??$(83#($J#<5G5#?(#0#>#&8(8/(83#(head(/G(83#(05$81(FG8#+(835$(>#83/?-(*(&#@(3#*?(5$(<+#*8#?
*&?(J/5&8$(8/(83#(/0?(3#*?(*$(58$($%<<#$$/+1(;3#(&#@0"(*??#?(#0#>#&8(&/@(+#$5?#$(*8(83#(3#*?(/G(83#(05$81
H/5?(addLastOE(#R1(F??$(83#($J#<5G5#?(#0#>#&8(8/(83#(tail(/G(83#(05$81(.*>#(*$(83#(>#83/?(addOE(#R(O#c<#J8(G/+(83#
+#8%+&(8"J#R1(FG8#+(835$(>#83/?-(*(&#@(8*50(5$(<+#*8#?(*&?(J/5&8$(8/(83#(/0?(8*50(*$(58$(J+#?#<#$$/+1(;3#(&#@0"
*??#?(#0#>#&8(&/@(+#$5?#$(*8(83#(8*50(/G(83#(05$81
E(removeFirstOE(#R1(l#>/H#$(*&?(+#8%+&$(83#(#0#>#&8(*8(83#(head(/G(05$81(FG8#+(835$(>#83/?-(83#($%<<#$$/+(O5&
83#(/+5'5&*0(05$8R(8/(83#(+#>/H#?(3#*?(A#</>#$(83#(&#@(3#*?(/G(83#(05$81(;3#(>#83/?(83+/@$(*
NoSuchElementException(5G(83#(05$8(5$(#>J8"1
E(removeLastOE(#R1(l#>/H#$(*&?(+#8%+&$(83#(#0#>#&8(*8(83#(tail(/G(05$81(FG8#+(835$(>#83/?-(83#(J+#?#<#$$/+(O5&
83#(/+5'5&*0(05$8R(8/(83#(+#>/H#?(8*50(A#</>#$(83#(&#@(8*50(/G(83#(05$81(;3#(>#83/?(83+/@$(*
NoSuchElementException(5G(83#(05$8(5$(#>J8"1
E(getFirstOR1(l#8%+&$(83#(?*8*(*8(83#(head(/G(83#(05$81(;3#(>#83/?(83+/@$(*(NoSuchElementException(5G(83#(05$8
5$(#>J8"1
E(getLastOR1(l#8%+&$(83#(?*8*(*8(83#(tail(/G(83#(05$81(;3#(>#83/?(83+/@$(*(NoSuchElementException(5G(83#(05$8(5$
#>J8"1
F$(83#(ArrayListxEy(<0*$$-(83#(LinkedListxEy(<0*$$(3*$(83#(G/00/@5&'(8@/(</&$8+%<8/+$1
;3#(?#G*%08(</&$8+%<8/+(LinkedListOR(<+#*8#$(*&(#>J8"(05&,#?(05$81