What is the advantage of linked list over an array and vice versa?

前端 未结 6 2023
南旧
南旧 2021-01-30 18:12

Please explain what is the advantage of linked list over an array. And also is there any advantage of using array compared to linked list.

Regards, Shoaib

6条回答
  •  长情又很酷
    2021-01-30 18:47

    Arrays have a fixed size but are faster to access: they are allocated in one place and the location of each element is known (you can jump to the right element).

    Lists are not limited in size but for the amount of available memory. They are slower to access since to find an element you have to traverse the list.

    This is a very short explanation: I would suggest you to get a book on data structures and read it. These are basic concepts that you will need to fully understand.

提交回复
热议问题