public void Append(Student d)
 {
     Node temp = new Node(d, null);
     temp.link = head;
     head = temp;
     size++;
 }
 public void Insert(Student d, int previousKey)
 {
     Node current = Search(previousKey);
     if (current != null)
     {
         Node temp = new Node(d, current.link);
         current.link = temp;
         size++;
     }
     else
     {
         Console.WriteLine("Insert was not successful");
     }
 }
        static void Main(string[] args)
        {
            LinkedList list = new LinkedList();
            Console.WriteLine("Append a single student");
            Student ibr = new Student(123, "Ibrahim", "Chen");
            list.Append(ibr);
            list.Display();
            Console.WriteLine();
            Console.WriteLine("Append a second student");
            Student chris = new Student(55, "Costic", "Sekmen");
            list.Append(chris);
            list.Display();
            Console.WriteLine("Remove a single student");
            Node removed = list.Remove();
            Console.WriteLine("removed Node is TNumber = {0}, Name = {1}, Advisor = {2}", removed.data.TNumber, removed.data.Name, removed.data.Advisor);
            list.Display();
            Console.WriteLine("Remove a single student");
            Node removed2 = list.Remove();
            Console.WriteLine("removed Node is TNumber = {0}, Name = {1}, Advisor = {2}", removed2.data.TNumber, removed2.data.Name, removed2.data.Advisor);
            list.Display();
            Console.WriteLine("Appending 3 students");
            Student ryan = new Student(202, "Ryan", "Hayes");
            list.Append(ibr);
            list.Append(chris);
            list.Append(ryan);
            list.Display();

            Console.WriteLine("Searching for TNumber = 100");
            Node found = list.Search(100);
            if (found != null)
                Console.WriteLine("Found and Name {0}", found.data.Name);
            else
                Console.WriteLine("Not Found");
            Console.WriteLine("");
            Console.WriteLine("Searching for TNumber = 202");
            Node found2 = list.Search(202);
            if (found2 != null)
                Console.WriteLine("Found and Name {0}", found2.data.Name);
            else
                Console.WriteLine("Not Found");
            Console.WriteLine("");
            Console.WriteLine("Inserting Edmund after TNumber 202");
            Student edmund = new Student(34, "Edmund", "Erdemir");
            list.Insert(edmund, 202);
            Console.WriteLine();
            list.Display();
            Console.ReadLine();
        }
 public Node(Student s, Node p)
 {
     data = s;
     link = p;
 }
 public Node()
 {
     data = null;
     link = null;
 }