how to write this code in the form of Linked list with pointer concept
class Sequence
{
public ArrayList Nodes;
public Sequence Next;
}
class Program
{
static void Main(string[] args)
{
Sequence First, Current, Prev;
int[] a = { 1, 3, 4, 5, 8, 11, 13, 14, 15, 18, 20, 21,22,23,24 };
int diff = 1;
First = Current = Prev = null;
for (int i = 0; i < a.Length; i++)
{
Current = new Sequence();
if (First == null)
{
First = Current;
}
if (Prev != null)
Prev.Next = Current;
Prev = Current;
Current.Next = null;
Current.Nodes = new ArrayList();
for (int j = i+1 ; j < a.Length;j++ )
{
Current.Nodes.Add(a[j-1]);
if (a[j] - a[i] == diff)
diff++;
else
{
diff = 1;
i = j-1;
Current = null;
break;
}
if (j == a.Length - 1)
{
Current.Nodes.Add(a[j]);
i = j - 1;
}
}
}
}
}
Guna..............