public Node(T value, Node<T> next)
public T GetValue() { return this.value; }
public Node<T> GetNext() { return this.next; }
public void SetValue(T value) { this.value = value;}
public void SetNext(Node<T> next) { this.next= next; }
public Pixel(int red, int green, int blue)
public void SetRed(int red) { this.red= red; }
public void SetGreen(int green) { this.green=green; }
public void SetBlue(int blue) { this.blue=blue; }
{ return this.red > 0 && this.green == 0 && this.blue == 0; }
{ return this.red == 0 && this.green > 0 && this.blue == 0; }
{ return this.red == 0 && this.green == 0 && this.blue > 0; }
public override string ToString()
return "Red=" + this.red + " Green=" + this.green + " Blue=" + this.blue;
public static bool IsPixelInList(Node<Pixel> head,int r,int g,int b)
if(head.GetValue().GetRed() == r &&
head.GetValue().GetGreen() == g &&
head.GetValue().GetBlue() == b)
public static void PrintAboveAverage(Node<double> node)
double average = ListAverage(node);
if (node.GetValue() > average)
Console.WriteLine(node.GetValue()+" is bigger than the average");
public static double ListAverage(Node<double> node)
public static void PrintList(Node<int> head)
Console.WriteLine(head.GetValue());
public static int ListSize(Node<int> head)
public static void Main()
Node<int> n = new Node<int>(10);
Node<int> n1 = new Node<int>(20);
Node<int> n2 = new Node<int>(30);
Node<double> dn = new Node<double>(90);
Node<double> dn1 = new Node<double>(90.5);
Node<double> dn2 = new Node<double>(84.5);
Node<double> dn3 = new Node<double>(96);
Console.WriteLine("Printing the list...");
Console.WriteLine("Checking the list size...");
Console.WriteLine(ListSize(n));
Console.WriteLine("Checking the list size again...");
Console.WriteLine(ListSize(n1));
Console.WriteLine("Calling the list average...");
Console.WriteLine(ListAverage(dn));
Console.WriteLine("\n--- Some pixel stuff --");
Pixel pix = new Pixel(230, 34, 55);
Pixel pix1 = new Pixel(120, 0, 0);
Pixel pix2 = new Pixel(120, 80, 0);
Console.WriteLine(pix1.IsRed());
Console.WriteLine(pix1.IsGreen());
Node<Pixel> npx = new Node<Pixel>(pix);
Node<Pixel> npx1 = new Node<Pixel>(pix1);
Node<Pixel> npx2 = new Node<Pixel>(pix2);
Console.WriteLine("Using Targil 3 with Node of pixels.. ");
Console.WriteLine(IsPixelInList(npx,120,80,0));