2 Replies - 4852 Views - Last Post: 13 April 2010 - 03:48 PM Rate Topic: -----

#1 Guest_mike*


Reputation:

ADT list and list

Posted 13 April 2010 - 02:36 PM

Ive got a Java exam comming up and i wanted to know what the difference is between a ADT list and a list. As im going over the past exam papers and finding this question akward to answer.
Is This A Good Question/Topic? 0

Replies To: ADT list and list

#2 nick2price  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 561
  • View blog
  • Posts: 2,826
  • Joined: 23-November 07

Re: ADT list and list

Posted 13 April 2010 - 02:41 PM

By ADT, I presume you mean a linked list

Quote

The difference between List and LinkedList lies in their underlying implementation. List is array based collection (ArrayList). LinkedList is node-pointer based collection (LinkedListNode). On the API level usage, both of them are pretty much the same since both implement same set of interfaces such as ICollection, IEnumerable, etc.

The key difference comes when performance matter. For example, if you are implementing the list that has heavy "INSERT" operation, LinkedList outperforms List. Since LinkedList can do it in O(1) time, but List may need to expand the size of underlying array.

Was This Post Helpful? 1
  • +
  • -

#3 macosxnerd101  Icon User is offline

  • Self-Trained Economist
  • member icon




Reputation: 10397
  • View blog
  • Posts: 38,465
  • Joined: 27-December 08

Re: ADT list and list

Posted 13 April 2010 - 03:48 PM

In Java, List is an interface. It forces implementing classes to define key methods for interacting with a formal "list" structure, like a dynamic array (ArrayList) or an ADT (Linked) List. I think nick2price summed it up pretty well. However, if you are looking for more specific information on Linked Lists, you may want to check out my Linked List Tutorial, which examines the implementation and efficiencies of a Linked List and its methods.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1