Exercise: List OperationExercise: List Operation
What would the contents of a list be after the following What would the contents of a list be after the following
operations?operations?
Initialise(L)Initialise(L)
Add(0,A,L)Add(0,A,L)
Add(0,F,L)Add(0,F,L)
Add(1,X,L)Add(1,X,L)
Add(1,G,L)Add(1,G,L)
Add(3,P,L)Add(3,P,L)
Add(2,V,L)Add(2,V,L)
Set(3,K,L)Set(3,K,L)
Set(0,H,L)Set(0,H,L)
Remove(V,L)Remove(V,L)
Remove(P,L)Remove(P,L)
H G K AH G K A
What values would be returned by the following What values would be returned by the following
operations?operations?
IndexOf(A,L)IndexOf(A,L)
IndexOf(H,L)IndexOf(H,L)
Get(3,L)Get(3,L)