Java单链表基本操作(六)--删除重复节点;
2016-04-01 12:01
585 查看
package listnode; public class DeleteDuplecate_SingleList { public static void main(String[] args) { Node head=ListNode.getSingleList(); ListNode.printList(head); deleteNode(head); ListNode.printList(head); } public static void deleteNode(Node head){ while(head.next!=null){ Node p=head; while(p.next!=null){ if(p.next.data==head.data){ p.next=p.next.next; } p=p.next; } head=head.next; } } }
代码中调用的Node类和ListNode类,代码详见
Java单链表基本操作(一)–顺序查找
相关文章推荐
- 使用IntelliJ IDEA,gradle开发Java web应用步骤
- 单链表<br>java单链表的实现, 多线程 ,读写锁
- Java单链表基本操作(五)--查找倒数第K个节点
- (二)springmvc--构建一个springmvc web项目
- java 数据类型
- Eclipse快捷键
- 论Java Web应用中调优线程池的重要性
- Java反射
- 开始java之路
- Java单链表基本操作(四)--单链表反转
- java中static作用详解
- (10)json字符转 转JavaBean,且bean中还有List<T>属性 ,重点@JsonProperty("tags") [jackson]
- 四种Java线程池用法解析
- java获得当前文件路径
- spring boot和mybatis整合
- 史上最全最强SpringMVC详细示例实战教程
- JavaWeb学习笔记——JDOM
- Spring事务配置的五种方式
- 归并排序java实现
- Java中的Process,执行一个命令