如何在链接列表中查找循环 [英] How Can I Find Loop In A Linked List

查看:80
本文介绍了如何在链接列表中查找循环的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设下面有一些元素

20,23,45,67.12

如何找到循环退出或不退出

suppose some elemnts are there below
20,23,45,67.12
how can i find loop is exit or not

推荐答案

请参阅:检测单链接中的循环列表 [ ^ ]。


这个问题没有任何意义,原因如下:



你展示的例子没有提出任何有关系的结构,所以没有办法谈论循环。

链表没有循环。

有些人考虑循环链表。那些,如果不是空的,总是只有一个循环,所以没有什么可以找到。



-SA
The question makes no sense by the following reasons:

The example you show does not present any structure with relationship, so there is no a way to talk about a loop.
A linked list does not have loops.
Some consider the circular linked lists. Those, if not empty, always have exactly one loop, so there is nothing to find.

—SA


这篇关于如何在链接列表中查找循环的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆