Code
Using system;
Using system. Collections. Generic;
Using system. LINQ;
Using system. text;
Using system. collections;
Using system. Collections. Specialized;
Using system. Threading;
Using system. reflection;
Using system. Data;
Namespace testarray
{
Class Program
{
/// <Summary>
/// Test the chain Storage Class Structure
/// </Summary>
/// <Param name = "ARGs"> </param>
Static void Main (string [] args)
{
String s1 = "red ";
String s2 = "blue ";
String s3 = "yellow ";
Structure <string> l = new structure <string> ();
L. addData (new primary node <string> (s1 ));
L. addData (new worker node <string> (s2 ));
L. addData (new vertex node <string> (s3 ));
L. displayData ();
Console. ReadLine ();
}
}
// Data element storage Representation
Class worker node <T>
{
T data;
Random node <T> next; // links randomly stored elements by referencing them.
Public writable node (T val)
{
Data = val;
Next = NULL;
}
Public t data
{
Get {return data ;}
Set {DATA = value ;}
}
Public writable node <t> next
{
Get {return next ;}
Set {next = value ;}
}
}
// Storage representation and Algorithm Implementation of Data Element relationships
Class Structure <T>
{
Worker node <T> first;
Worker node <T> current;
Public topology structure ()
{
First = null;
}
Public void addData (writable node <T> var)
{
If (first = null)
{
First = var;
Current = var;
Return;
}
Else
{
Current. Next = var;
Current = var;
}
}
Public void displayData ()
{
Current = first;
While (current! = Null)
{
Console. Write (current. Data + "");
Current = current. Next;
}
}
}
}