惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
宝玉的分享
宝玉的分享
P
Proofpoint News Feed
I
Intezer
云风的 BLOG
云风的 BLOG
A
About on SuperTechFans
aimingoo的专栏
aimingoo的专栏
Y
Y Combinator Blog
小众软件
小众软件
T
Threatpost
B
Blog
美团技术团队
博客园 - 司徒正美
T
The Exploit Database - CXSecurity.com
T
Tailwind CSS Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Cyberwarzone
Cyberwarzone
雷峰网
雷峰网
The GitHub Blog
The GitHub Blog
T
Tenable Blog
A
Arctic Wolf
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Security Archives - TechRepublic
Security Archives - TechRepublic
博客园 - 叶小钗
L
Lohrmann on Cybersecurity
博客园 - 三生石上(FineUI控件)
L
LINUX DO - 热门话题
J
Java Code Geeks
Google DeepMind News
Google DeepMind News
S
Security Affairs
Simon Willison's Weblog
Simon Willison's Weblog
K
Kaspersky official blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
GbyAI
GbyAI
N
News and Events Feed by Topic
Cloudbric
Cloudbric
WordPress大学
WordPress大学
量子位
W
WeLiveSecurity
H
Hacker News: Front Page
Project Zero
Project Zero
S
Security @ Cisco Blogs
Security Latest
Security Latest
Hugging Face - Blog
Hugging Face - Blog
Forbes - Security
Forbes - Security
C
Cybersecurity and Infrastructure Security Agency CISA
人人都是产品经理
人人都是产品经理
U
Unit 42
Know Your Adversary
Know Your Adversary
Google Online Security Blog
Google Online Security Blog

博客园 - 如斯夫

Windows Azure中的Affinity Group .NET内存管理 .NET程序的运行与内存管理 堆栈和堆 应用程序的装载与运行 字符串匹配算法 – Sunday算法 该怎么教育 COM学习 完成了吗? 技术人员面试流程泳道图 创建型模式 C# 面试题目 单链表中删除重复数据 C# 面试算法 人的问题 foreach中的隐式类型转换 C# 点滴 - 枚举 数据库惊魂 没有人能随随便便成功 If you are a new test manager – From google testing blog
C# 数据结构 单链表反转
如斯夫 · 2010-03-04 · via 博客园 - 如斯夫

首先,单链表本身是一个递归定义的数据结构,也就是说,单链表中每个节点指向的依然是一个单链表,所以可以使用递归的特性来完成这个问题:

        static Node ReverseLink(Node list)
        {
            if (list.next == null)
            {
                return list;
            }
            else
            {
                Node n = ReverseLink(list.next);
                list.next.next = list;
                list.next = null;
                return n;
            }
        }

list.next.next = list;
list.next = null;

这两行是最终实现反转的地方,这里的第一行将当前节点的下一个节点的指针指向自己,然后将当前节点到下一个节点的断开,从而实现反转。