C#数据结构链表排序,如何排序?
//链表排序public void paixu(ref LinkedList a)//有参数链表a的,参数在main函数
{
Node tempNode = a.head;
for (int i = 0; i < count; i++)
{
for (int j = 0; j < count; j++)
{
if ((int)tempNode.item > (int)tempNode.next.item )//这行报错
{
int b = 0, c = 0, d = 0;
c = (int)tempNode.next.item;
b = (int)tempNode.item;
d = c;
c = b;
b = d;
}
tempNode = tempNode.next;
}
}
}
然后我就没头绪了....不知道在哪里修改