zoukankan
html css js c++ java
数据结构 节点的反转
Code
1
//
链表反转
2
list
*
invert(list
*
head)//head为头节点
3
{
4
list
*
p ,
*
q ,
*
r ;
5
p
=
head;
6
q
=
NULL;
7
while
( p
!=
NULL)
8
{
9
r
=
q;
//
r指向前一个节点
10
q
=
p;
//
他们指向同一个节点
11
p
=
p
->
next;
//
p指向下一个节点
12
q
->
next
=
r;
13
}
14
return
q;
15
}
查看全文
相关阅读:
[ARC074C] RGB Sequence
[SHOI2014] 概率充电器
CF368B Sereja and Suffixes
CF980D Perfect Groups
Rainbow Roads(gym101617G)(DFS序,差分)
Educational Codeforces Round 104 (Rated for Div. 2)(A~E)
Floor and Mod(CF1485C)(数论)
Longest Simple Cycle(CF1476C)(线性dp)
Factories(Gym102222G)(树形dp+背包)
Codeforces Round #699 (Div. 2)(A,B,C,D)
原文地址:https://www.cnblogs.com/moli/p/1434265.html
最新文章
当Math.round() 遇到 .5
如何尽可能避免重定向
跨域分析与解决思路
vue.config.js 配置路径别名
text-shadow知多少
B
A
我的头文件 ( = =。
N
M
热门文章
G
E
D
C
B
CF862E Mahmoud and Ehab and the function
CF1312C Adding Powers
CF1299A Anu Has a Function
CF226C Anniversary
[AGC001E] BBQ Hard
Copyright © 2011-2022 走看看