删除单个链接列表中需要O(1)时间的节点 [英] Delete a node in a single link list that takes O(1) time

查看:74
本文介绍了删除单个链接列表中需要O(1)时间的节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何编写代码来删除单个链接列表中的特定节点

需要O(1)时间? (链接列表使用指针,而不是哈希。 £?也就是说,删除节点的时间是相同的(独立于

列表的长度。显示你的c / c ++源代码。

How to write code to delete a specific node in a single link list that
takes O(1) time? £¨ link list uses pointers, not hash. £? That is, the
time deleting a node is the same (independent from the length of the
list. Show your c/c++ source code.

推荐答案

hotice写道:
hotice wrote:

如何编写代码来删除单个节点中的特定节点链接列表

需要O(1)时间?(链接列表使用指针,而不是哈希。)也就是说,删除节点的

时间是相同的(独立于

列表的长度。显示你的c / c ++源代码。
How to write code to delete a specific node in a single link list that
takes O(1) time? £¨ link list uses pointers, not hash. £? That is, the
time deleting a node is the same (independent from the length of the
list. Show your c/c++ source code.



你首先!


-

Ian Collins。

You first!

--
Ian Collins.


hotice< xu ******* @ gmail.comwrote:
hotice <xu*******@gmail.comwrote:

如何编写代码来删除单个链接列表中的特定节点

需要O(1)时间?£?链接列表使用指针,而不是哈希。£?也就是说,删除一个节点的

时间是相同的(独立于

列表。显示您的c / c ++源代码。
How to write code to delete a specific node in a single link list that
takes O(1) time? £? link list uses pointers, not hash. £? That is, the
time deleting a node is the same (independent from the length of the
list. Show your c/c++ source code.



想想单个链表的工作原理。这样的

列表中的节点是什么?它有什么属性?现在想想几种方法从列表中删除一个节点

。你需要做什么信息?请不要使用不同的删除策略来获取不同的信息吗?


如果没有代码,请执行上述所有操作。写一个简单的描述

需要用你觉得最舒服的语言。

Think about how a single linked list works. What is a node in such a
list? What properties does it have? Now think of a couple ways to remove
a node from the list. What information do you need to do it? Do
different removal strategies require different information?

Do all the above without code first. Write a simple description of what
needs to happen in what ever language you feel most comfortable in.


5月18日晚上8:48 ,hotice< xuxin2 ... @ gmail.comwrote:
On May 18, 8:48 pm, hotice <xuxin2...@gmail.comwrote:

如何编写代码来删除单个链接列表中的特定节点

需要O(1)时间? (链接列表使用指针,而不是哈希。 £?也就是说,删除节点的时间是相同的(独立于

列表的长度。显示你的c / c ++源代码。
How to write code to delete a specific node in a single link list that
takes O(1) time? £¨ link list uses pointers, not hash. £? That is, the
time deleting a node is the same (independent from the length of the
list. Show your c/c++ source code.



你所描述的不再是一个链表了。

显示你自己的代码。

What you describe is not a linked list anymore.
Show your own code.


这篇关于删除单个链接列表中需要O(1)时间的节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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