做反转之前,应该先判断该单链表是否有环,判断方法参见

http://www.cnblogs.com/jiajinyi/archive/2010/01/27/1657845.html

 

        static void Reverse(SingleLinkNode node)
        {
            SingleLinkNode temp = null, current = null;
            while (node != null)
            {
                temp = current;
                current = node;
                node = node.NextNode;
                current.NextNode = temp;
            }
        }

相关文章:

  • 2022-12-23
  • 2022-02-14
  • 2022-12-23
  • 2021-08-15
  • 2022-12-23
猜你喜欢
  • 2021-12-26
  • 2021-12-02
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-17
相关资源
相似解决方案