Why was list created

why was list container created specially even though an array is also a container.

can’t it be done on the existing array like

search(arr.begin(), arr.end(), key)

Hello @Parmeet-Kalsi-1631789033630118,

List is used to provide an efficient memory managemnet.
Array requires the continuous memory location while list can have distributed memory locations/

You can read the differences in detail from the following link:

Hope, this would help.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.