标签:htm while blog 输入 html bsp turn 输出 reverse
有看到用c++实现的 :http://www.cnblogs.com/venow/archive/2012/08/26/2657559.html
输入单链:1->2->3->4->5
输出: 5->4->3->2->1
public Node reverse (Node node){
Node curNode = node;
Node storeNode = null;
while (curNode != null) {
Node nextNode = curNode.next;
curNode.next = storeNode;
storeNode = curNode;
if (nextNode != null){
curNode = nextNode;
}
}
return storeNode;
}
标签:htm while blog 输入 html bsp turn 输出 reverse
原文地址:https://www.cnblogs.com/Jennifer-fang/p/9974777.html