输入一个链表,反转链表后,输出链表的所有元素
2016-11-09 17:48
375 查看
import com.doubleLinkedList.Node; public class ReverseList { public Node ReverseList1(Node head){ Node current=head; Node prevnode=null; Node newhead=null; if(current==null){ throw new NullPointerException("no node this listnode!"); } while(current!=null){ Node nextnode=current.next; current.next=prevnode; if(nextnode==null){ newhead=current; } prevnode=current; current=nextnode; } return newhead; } }
相关文章推荐
- 输入一个链表,反转链表后,输出链表的所有元素。
- java 输入一个链表,反转链表后,输出链表的所有元素。
- 输入一个链表,反转链表后,输出链表的所有元素。
- 剑指offer:输入一个链表,反转链表后,输出链表的所有元素。
- 输入一个链表,反转链表后,输出链表的所有元素。
- 剑指offer--输入一个链表,反转链表后,输出链表的所有元素。
- 输入一个链表,反转链表后,输出链表的所有元素。
- 输入一个链表,反转链表后,输出链表的所有元素。
- 输入一个链表,反转链表后,输出链表的所有元素。
- 输入一个链表,反转链表后,输出链表的所有元素。
- 输入一个链表,反转链表后,输出链表的所有元素。
- java实现输入一个链表,反转链表后,输出链表的所有元素。
- 输入一个链表,反转链表后,输出链表的所有元素。
- 输入一个链表,反转链表后,输出链表的所有元素。就地逆转,头插法
- 输入一个链表,反转链表后,输出链表的所有元素。
- 反转链表-输入一个链表,反转链表后,输出链表的所有元素。
- 输入一个数组长度,动态创建数组,所有元素随机生成,输出元素中最大值
- // 1、输入一个数组长度,动态创建数组,所有元素随机生成,输出元素中的最大值
- 输入一个数组长度,动态创建数组,所有元素随机生成,输出元素中的最大值
- 3.输入一个数组长度,动态创建数组,所有元素随机生成,输出元素中的最大值