You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sandesh Kota edited this page May 16, 2019
·
36 revisions
Node (value | next-pointer)
Node Chains (two/more nodes connecting with help of next-pointers)
public class Node
{
public int Value { get; set; }
public Node Next { get; set; }
}
Node first = new Node { Value = 3 };
Node middle = new Node { Value = 5 };
first.Next = middle;
Node last = new Node { Value = 9 };
middle.Next = last;
Linked List
Single chain of nodes
Head Pointer
Tail Pointer
Operations: Add, Remove, Find, Enumerate
If there is only one item in the list, then both head and tail pointers will point to single node
Adding: Will update the head/tail pointer and the corresponding next-pointer (in case of array there will be
performance impacts ex: adding a new value at the beginning will have to shift all the other values by one step)