Sunday 22 September 2019

data structures - Array versus linked-list

Why would someone want to use a linked-list over an array?




Coding a linked-list is, no doubt, a bit more work than using an array and one may wonder what would justify the additional effort.



I think insertion of new elements is trivial in a linked-list but it's a major chore in an array. Are there other advantages to using a linked list to store a set of data versus storing it in an array?



This question is not a duplicate of this question because the other question is asking specifically about a particular Java class while this question is concerned with the general data structures.

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...