day92(6.12)
来源:互联网 发布:天书世界披风数据 编辑:程序博客网 时间:2024/06/14 12:02
其实不是很懂,为什么链表要一定要说明有环,意义是什么呢。虽然程序能实现,但感觉操作意义不大。吸收到的东西不大。
package NOdeTest;
import org.w3c.dom.Node;
public class LinkIsLoop {
private Node head = null;
private Node node = null;
private Node node2 = null;
private int temp;
public void LinkIsloop(Node head) {
this.head = head;
this.node = head;
this.node2 = head.next;
this.findentrance(head);
}
private void isloop(Node head2) {
// TODO Auto-generated method stub
}
private void findentrance(Node head2) {
Node node = head2;
Node node2 = node.next;
while (node != null) {
node2 = node.next;
while (node2 != null) {
if (node == node2) {
// 说明有环
System.out.println("**************链表有环!!!***********");
System.out.println("**************链表的入口是" + node.obj+"**************");
// node2.next=node;
break;
}
node2 = node2.next;
}
if (node == node2) {
break;
}
node = node.next;
}
System.out.println("****************链表没没没有环!!**************");
}
}
0 0
- day92(6.12)
- 6.12
- 6.12
- 6.12
- 6.12
- 6.12
- 6.12
- 6.12
- 6.12
- 6.12
- 6.12
- 6.12
- 6.12
- 6.12
- 6.12
- 6.12
- 6.12
- 6.12
- day90(6.10)
- 解说论坛要用什么“花招”来留住用户
- 8张图理解Java
- day91(6.11)
- C++Primer 第五版 4.高级主题
- day92(6.12)
- C语言文件打开方式
- Source insight / Visual studio 2012 / UltraEdit 中显示TAB符用4个空格代替
- 章1例题
- day(93.6.13)
- nginx-upload-progress
- 第十六周工作总结
- Haskell学习——函数
- 静态页面生成功能实现构想