| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1751 人关注过本帖
标题:有关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
快速回复:有关C#数据结构链表排序问题
数据加载中...
 
   



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

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