标题:有关C#数据结构链表排序问题
只看楼主
冷锋2048
Rank: 1
等 级:新手上路
帖 子:16
专家分:0
注 册:2015-10-27
结帖率:57.14%
 问题点数:0 回复次数:0 
有关C#数据结构链表排序问题
//链表的排序
        public void paixu(ref LinkedList a)//a为链表
        {

            Node tempNode = a.head;
            for (int i = 0; i < count + 1; i++)
            {
                int x = 1;
                x = x + i;
                for (int j = 0; j < count + 1; j++)
                {
                        if ((int)a.head.item > (int)a.head.next.item)
                        {
                            a.head.next.next = a.head .next;
                             a.head.next =  a.head;
                        }
                        else
                        {
                            continue;
                        }                 
                        if ((int)tempNode.item > (int)tempNode.next.item & tempNode.next.next != null)
                        {
                            Node preNode = GetByIndex(x - 1);
                            tempNode.next = preNode.next;
                            tempNode = tempNode.next;
                            tempNode.next.next = tempNode.next;
                            x++;
                        }
                        else
                        {
                            x++;
                        }
                        if ((int)tempNode.item > (int)tempNode.next.item & tempNode.next.next == null)
                        {
                            Node preNode = GetByIndex(x - 1);
                            tempNode.next = preNode.next;
                            tempNode = tempNode.next;
                        }                  
                    tempNode = tempNode.next;
                }
            }
搜索更多相关主题的帖子: public count 
2016-06-01 22:21



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-465494-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.085411 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved