static void Main(string[] args)
        {
            Console.Title = "将两个学生信息表交叉合并";

            StudentLinkList list1 = new StudentLinkList(5);         //创建含有5个元素的学生信息链表
            StudentNode node1 = list1.Head;                         //学生信息表1的头结点设为当前结点
            Console.WriteLine("输出学生信息表1:");
            while (node1 != null)
            {
            Console.Write(node1.Student.Name + "\t");
            node1 = node1.Next;                                 //将下一结点设置为当前结点
            }
            Console.WriteLine("\n\n输出学生信息表2:");
            StudentLinkList list2 = new StudentLinkList(5);         //创建含有5个元素的学生信息链表
            StudentNode node2 = list2.Head;                         //学生信息表2的头结点设为当前结点
            while (node2 != null)
            {
            Console.Write(node2.Student.Name + "\t");
            node2 = node2.Next;                                 //将下一结点设置为当前结点
            }

            node1 = list1.Head;                                     //重置表1当前结点
            node2 = list2.Head;                                     //重置表2当前结点
            //将学生信息表2合并到学生信息表1中
            while (node1 != null && node2 != null)
            {
            list2.Head = node2.Next;                            //将表2当前结点从表2中删除
            node2.Next = node1.Next;                            //将表1当前结点的后续结点拼接到表2当前结点
            node1.Next = node2;                                 //将表2当前结点作为表1当前结点的下一结点
            node1 = node2.Next;                                 //表1当前结点指向表2当前结点的下一结点
            node2 = list2.Head;                                 //表2当前结点指向表2的头结点
            }

            Console.WriteLine("\n\n输出合并后的学生信息表1:");
            node1 = list1.Head;
            while (node1 != null)
            {
            Console.Write(node1.Student.Name + "\t");
            node1 = node1.Next;
            }

            Console.Read();
        }
        static void Main(string[] args)
        {
            Console.Title = "将学生按年级和成绩进行排序";

            StudentLinkList students = new StudentLinkList(20);
            Console.WriteLine("排序前的学生信息表:");
            StudentNode node = students.Head;
            while (node != null)
            {
                Console.WriteLine("姓名:{0}\t年级:{1}\t成绩:{2}", node.Student.Name, node.Student.Grade, node.Student.Result);
                node = node.Next;
            }

            Console.ReadLine();

            Console.Clear();
            Console.WriteLine("按成绩排序后的学生信息表:");

            StudentQueue[] studentsResult = new StudentQueue[101];  //创建成绩队列列表
            node = students.Head;
            //将学生按成绩映射到指定索引的队列中
            while (node != null)
            {
            if (studentsResult[node.Student.Result] == null)
            studentsResult[node.Student.Result] = new StudentQueue();
            studentsResult[node.Student.Result].In(node.Student);
            node = node.Next;
            }
            StudentNode head = null, rear = null;
            //将队列按索引从小到大首尾相连
            for (int i = 100; i >= 0; i--)
            {
            if (studentsResult[i] != null)
            {
            if (head == null) head = studentsResult[i].Front;//第一个不为空的队列
            else rear.Next = studentsResult[i].Front;
            rear = studentsResult[i].Rear;                  //标记队尾
            }
            }

            node = head;
            while (node != null)
            {
                Console.WriteLine("姓名:{0}\t年级:{1}\t成绩:{2}", node.Student.Name, node.Student.Grade, node.Student.Result);
                node = node.Next;
            }

            Console.ReadLine();
            Console.Clear();
            Console.WriteLine("按年级排序后的学生信息表:");

            StudentQueue[] studentsGrade = new StudentQueue[5];     //创建年级队列列表
            node = head;
            //将学生按年级映射到指定索引的队列中
            while (node != null)
            {
            if (studentsGrade[node.Student.Grade] == null)
            studentsGrade[node.Student.Grade] = new StudentQueue();
            studentsGrade[node.Student.Grade].In(node.Student);
            node = node.Next;
            }
            head = null; rear = null;
            //将队列按索引从小到大首尾相连
            for (int i = 4; i >= 1; i--)
            {
            if (studentsGrade[i] != null)
            {
            if (head == null) head = studentsGrade[i].Front;//第一个不为空的队列
            else rear.Next = studentsGrade[i].Front;
            rear = studentsGrade[i].Rear;                   //标记队尾
            }
            }

            node = head;
            while (node != null)
            {
                Console.WriteLine("姓名:{0}\t年级:{1}\t成绩:{2}", node.Student.Name, node.Student.Grade, node.Student.Result);
                node = node.Next;
            }

            Console.ReadLine();
        }