日期:2014-05-16  浏览次数:20898 次

C# 链表问题
初学c#, 请高手帮忙纠正一下下面的代码,怎么能倒序打印 linked list, 多谢! 

 public LinkedList<T> reverse()
    {
        LinkedList<T> r = new LinkedList<T>();
        r.head = reverseCells(head);
        return r;
    }
    private Cell<T> reverseCells(Cell<T> r)
    {
        int count = 0;
        r = head;
        Cell<T> temp = r;
        head = head.next();
        count--;
        while(head.next() == null)
            temp = head;
        return new Cell<T>(temp.data(), reverseCells(head.next()));
    }

------解决方案--------------------
http://msdn.microsoft.com/zh-cn/Library/de80z2x6(v=vs.100).aspx