private static void Main(string[] args) { RList l = new RList(1); l.Insert(5); l.Insert(2); l.Insert(3); l.Insert(4); l.ReversePrintList(); l.Sort(); l.ReversePrintList(); }
public static RList operator +(RList l1, RList l2) { RList res = new RList(); Node node = l1.Root; while (node != null) { res.Insert(node.Data); node = node.Next; } node = l2.Root; while (node != null) { res.Insert(node.Data); node = node.Next; } return(res); }
public static RList operator -(RList l1, RList l2) { RList res = new RList(); Node node = l1.Root; while (node != null) { res.Insert(node.Data); node = node.Next; } node = l2.Root; while (node != null) { if (res.Search(node.Data) >= 0) { res.DeleteNode(res.Search(node.Data) + 1); } node = node.Next; } return(res); }