Wednesday, November 23, 2011

Data Structure: What is linked list?

Following points illustrates about what is linked list.

  • It is a special list of some data elements linked to one another.
  • Logical ordering is represented by having each elements pointing to next element.
  • each element is called node, which has two parts, (a) Info – stores the information (or data) (b) next – points to next element (i.e. address of next node)
  • Grow or shrink depending upon operation mode.
  • Entire linked list is accessed from an external pointer that contains the address of first node, but this is not included in the linked list.
  • The next address of last node contains special value called NULL, represented by electrical ground symbol.

Advantage of Linked list over array

  1. Dynamic nature i.e. grow or shrink according to operation performed.
  2. Insertion deletion are efficient and easier.
  3. Necessary memory utilization.

Disadvantage of Linked list

  1. Arbitrary access is difficult and time consuming.
  2. Extra memory is required for storing address of the next node.

The implementation of C++ in linked list will be discussed in next post.

No comments:

Post a Comment