public class NewClass public class Node public int value public Node n

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
public class NewClass
{
public class Node
{
public int value;
public Node next;
public Node (int value, Node next)
{
this.value = value;
this.next = next;
}
}
public Node head, tail;
public void WriteList()
{
for (Node i = head; i != null; i = i.next)
Console.Write("{0} ", i.value);
Console.WriteLine();
}
public int quantity = 0;
public void Add(int value)
{
if (head == null)
{
head = new Node(value, null);
tail = head;
}
else
{
tail.next = new Node(value, null);
tail = tail.next;
}
quantity++;
}
public NewClass Filterless(int n)
{
Node ListElement = this.head;
NewClass List = new NewClass();
while (ListElement.next != null)
{
if (ListElement.value < n)
List.Add(ListElement.value);
ListElement = ListElement.next;
}
if (ListElement.value < n) List.Add(ListElement.value);
return (List);
}
public NewClass Filtermore(int n)
{
Node ListElement = this.head;
NewClass List = new NewClass();
while (ListElement.next != null)
{
if (ListElement.value > n)
List.Add(ListElement.value);
ListElement = ListElement.next;
}
if (ListElement.value > n) List.Add(ListElement.value);
return (List);
}
public NewClass Search()
{
Node ListElement = this.head;
NewClass List = new NewClass();
while (ListElement.next != null)
{
if (ListElement.value == 0 && List.quantity == 0)
List.Add(ListElement.value);
ListElement = ListElement.next;
}
if (ListElement.value < 0) List.Add(ListElement.value);
return (List);
}
public void Handlinglist (Node i)
{
if (i.next != null)
Handlinglist(i.next);
this.Add(i.value);
}
public NewClass Concat(NewClass List1, NewClass List2)
{
NewClass List3 = new NewClass();
Node ListElement = List1.head;
while (ListElement != null)
{
List3.Add(ListElement.value);
ListElement = ListElement.next;
}
ListElement = List2.head;
while (ListElement != null)
{
List3.Add(ListElement.value);
ListElement = ListElement.next;
}
return List3;
}
}