arrays - Is Linked List an ADT or is it a Data Structure, or both? -


if use standard definition of abstract data type black box provides functions manage collection of data, linked list fits description:

a container offers functions add(x) , get(i) (among others) can used maintain list of objects.

but when ask question, time complexity of these operations, realize depends on how container implemented:

if internally maintain link head node, above 2 operations perform in o(n) time. if additionally maintain link tail node, you'll o(1) time on both.

so question is, learning purposes, consider linked list adt or data structure?

this question came when trying implement stack adt skiena's algorithm design manual, , reading how performance of it's put(x) , get() methods depend on data structure chosen implement it. book says in case doesn't matter if choose array or linked list data structure implement adt, both offer similar performance.

but they? doesn't depend on how link list implemented? there many ways implement linked list itself, doesn't fact make adt itself?

from wikipedia on adt: in computing, abstract data type (adt) mathematical model class of data structures have similar behavior so, linked list adt, , every adt data structure, linked list both.

edit:
however, notice singly-linked-list, , doubly-linked-list, both have same operations , same complexity these operations, both linked list adt, , not distinguish between them adt concerned. different data structures!


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -