public static bool IsPalindrome (BinNode<string> ls)
if (ls==null) return true;
BinNode<string> first = ls;
BinNode<string> last = ls;
while (last.GetRight()!=null)
if (!(first.GetValue().Equals(last.GetValue())))
Console.WriteLine(first.GetValue());
public static Node<int> FirstEvenLastOdd (Node<int> ls)
Node<int> first = new Node<int> (-99,ls);
while (prev.GetNext()!=null)
Node<int> last = new Node<int> (-99);
while (prev.GetNext()!=last)
if(prev.GetNext().GetValue()%2!=0)
prev.SetNext(prev.GetNext().GetNext());
prev.SetNext(last.GetNext());
public static Node<int> Dilul (Node<int> p)
p.SetNext(Remove1(p.GetNext(),p.GetValue()));
public static Node<int> Dilul2 (Node<int> p)
if (p.GetValue()==p.GetNext().GetValue())
p.SetNext(p.GetNext().GetNext());
p = Dilul2 (p.GetNext());
public static void Dilul3 (Node<int> p)
if (p.GetValue()==p.GetNext().GetValue())
p.SetNext(p.GetNext().GetNext());
public static BinNode<int> BuildBnlistInt ()
BinNode<int> duList = new BinNode<int> (int.Parse(Console.ReadLine()));
BinNode<int> last = duList;
int num = int.Parse(Console.ReadLine());
BinNode<int> p = new BinNode<int> (num);
num = int.Parse(Console.ReadLine());
public static void ShowBnlist (BinNode<string> lst)
BinNode<string> pos = lst;
Console.Write(pos.ToString());
public static BinNode<string> BuildBnlistIntByAr (string[] ar)
BinNode<string> lst = new BinNode<string>(ar[0]);
BinNode<string> pos = lst;
for (int i=1;i<ar.Length;i++)
p = new BinNode<string> (ar[i]);
public static Node<int> BuildListFromAr (int[] ar)
Node<int> lst = new Node<int>(ar[0]);
for (int i=1;i<ar.Length;i++)
pos.SetNext(new Node<int>(ar[i]));
public static Node<int> Build (int n)
Console.WriteLine("enter number");
x=int.Parse(Console.ReadLine());
pos.SetNext(new Node<int>(x));
public static Node<int> CreateList (int numNodes)
Node<int> lst = new Node<int>(-1);
for (i=1; i<=numNodes; i++)
Console.WriteLine("enter number");
x=int.Parse(Console.ReadLine());
pos.SetNext(new Node<int>(x));
public static void Show (Node<int> lst)
Console.Write(pos.ToString());
public static Node<int> Remove1 (Node<int> p, int val)
Node<int> dummy = new Node<int> (-999,p);
while (prev.GetNext()!=null)
if(prev.GetNext().GetValue()==val)
prev.SetNext(prev.GetNext().GetNext());
public static Node<int> Remove (Node<int> p, int val)
Node<int> dummy = new Node<int> (-999,p);
while (prev.GetNext()!=null && prev.GetNext().GetValue()!=val)
if (prev.GetNext()!=null)
if (prev.GetNext().GetValue()==val)
prev.SetNext(prev.GetNext().GetNext());
public static void Main()
Console.WriteLine("Hello World");
BinNode<string> ls=BuildBnlistIntByAr(a);
Console.WriteLine(IsPalindrome(ls));
this.first=new Node<T> (x,this.first);
T x=this.first.GetValue();
this.first=this.first.GetNext();
return this.first.GetValue();
public override String ToString()
Node<T> pos = this.first;
str=str+pos.GetValue().ToString();
public Node (T value, Node<T> next)
public void SetValue (T value)
public void SetNext(Node<T> next)
return this.next != null;
public override String ToString()
return this.value.ToString();
Node<T> temp = new Node<T>(x);
T x=this.first.GetValue();
this.first=this.first.GetNext();
return this.first.GetValue();
public override String ToString ()
Node<T> pos = this.first;
str=str+pos.GetValue().ToString();
private BinNode<T> right;
public BinNode (BinNode<T> left, T x, BinNode<T> right)
public BinNode<T> GetLeft()
public BinNode<T> GetRight()
public void SetValue(T x)
public void SetLeft(BinNode<T> left)
public void SetRight(BinNode<T> right)
public override String ToString ()
return value.ToString() + " <=> " ;
return value.ToString() + "";