Skip to content

34. Class System.Collections.Generic.LinkedList<T>

February 12, 2011

The class System.Collections.Generic.LinkedList<T> represents the concept of a doubly linked list: represented by a collection of nodes, each containing an element, each node is linked to the preceding node and the following node. The doubly linked list only knows the first and the last node.

The result is that access to an element happens in a time proportional to the number of elements, even though insertion or deletion happen at a constant time.

LinkedList is a linked list whose nodes are separated by the LinkedListNode type.
The class LinkedList<T> implements the interfaces ICollection<T>, IEnumerable<T>, ICollection and IEnumerable.
It contains the following members:
Properties:

 

  • First
    Gets the first node.
  • Last
    Gets the last node.
  •  

Methods:

 

  • void AddAfter(node, newNode)
    Adds the specified new node after the specified existing node.
  • void AddBefore(node, newNode)
    Adds the specified new node before the specified existing node.
  • void AddFirst(newNode)
    Adds the specified new node at the start of the LinkedList<T>.
  • void AddLast(newNode)
    Adds the specified new node at the end of the LinkedList<T>.
  • void Remove(<T>node)
    Removes the specified node from the LinkedList<T>.

Happy Programing! =)

Advertisements

From → OOP

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: