如何在循环链表中添加额外的节点+java
嗨,我是数据结构新手。我需要一个代码来理解java中循环链表中节点的添加和删除。如果能上传一些图片来演示就更好了。
Hi I'm new in data structure. I need an code to under stand the addition and deletion of a node in circular linked list in java. It'll be more good if you upload some picture to demonstrate.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Java 中没有内置循环链表。你必须自己写。
如果您的循环链表实现了 java.util.List 接口,您将这样做:
There is no circular linked list built into Java. You'll have to write your own.
If your circular linked list implements the
java.util.List
interface, you'll do it like this:您可以在维基百科上找到它,包括图像。
这是一个双向链表。前者适用于双向链表,但它与单链表非常相似。
循环在这里并不重要。唯一的区别是,在开始/结束处插入没有特殊情况。
e:对于损坏的链接深表歉意,已修复它们。
You can find it on wikipedia, including an image.
This one is for a doubly linked list. The former is for doubly linked lists but it is pretty similar for singly linked lists.
Being circular does not really matter here. The only difference is, that there are no special cases for inserting at beginning/end.
e: sorry for the broken links, fixed them.