I did this question by list hhow to access list randomly as we do in array as int n= a[k] i tried it but not getting it
Lists are sequence containers that allow non-contiguous memory allocation
this should answer your question since it is implemented usually as doubly linked list
hence random access is not allowed
u will have to use sequential iterator to iterate throught the list