c# - Benefit and disadvantage of linked list or array implementation of list -


this question has answer here:

what advantages linked-list implementation of list has on array-based implementation of array , vice-verse?

for starters know linked-list uses more space array because has use 4 bytes of space hold reference next node , array doesn't have that. array uses less space.

advantage linked-list has on array implementation array has fixed size @ initialization , have write code increase size of array may disadvantage when compared linked-list implementation.

any ideas on else advantage-disadvantage?

for array, can access element if have index (constant time complexity o(1) ). list, have iterate 1 one access although have index (time complexity o(n))

for list, inserting , deleting element take constant time (o(1)). array, inserting , deleting take o(n) time.

for sorting, list implementation better array implementation.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -

php - Accessing static methods using newly created $obj or using class Name -