Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
This post was edited and submitted for review 2 years ago and failed to reopen the post:
Original close reason(s) were not resolved
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
假设您在节点3。
因此,基本上您需要在删除之前删除该节点之后到达节点,因为这样可以访问它。
要检查是否有任何节点:
如果有节点:
请注意,如果您删除节点n并且您仍处于节点(N-1),则只需要进行单独的“ chrive of indience”,所以说,删除另一个节点。因此,如果您想删除以前曾经是PTH的节点,那么只需在if语句中进行
有效的操作,您将获得计数== p,当您到达PTH的节点直到任何删除。
Suppose you are at node 3.
So basically you need to get to the node after the one you seek to delete prior to that deletion as then there will be no way of accessing it.
To check if there are any nodes at all:
If there are nodes:
Notice that if you delete node n and you are still at node (n-1), you will just have to do a seperate "shift of indicies," so to say, to remove another node. So if you want to delete another node that was previously the pth one, then just do in the if statement
Effectively you will get count == p when you arrive at the node that was the pth one until any deletions.
对于您和我的初学者来说,这项任务并不简单。
然而,我们,初学者应该互相帮助。
对于C ++中的初学索引,从0开始。
其次,您应该检查从尾部开始的指针是否等于从头部开始的指针。还是一个指针是其他指针指向的节点的下一个数据成员的指针。
例如,如果两个指针彼此平等,则需要删除列表中的一个节点。
我无法编写伪代码。这对我来说太复杂了。
因此,您是
程序输出是
The task is not simple for such beginners as you and me.
Nevertheless, we, beginners, should help each other.
For starters indices in C++ start from 0.
Secondly you should check whether the pointer starting from the tail is equal to the pointer starting from the head. Or whether one pointer is the pointer of the data member next of the node pointed to by other pointer.
For example if the two pointers are equal each other you need to delete only one node in the list.
I can not write a pseudo code. It is too complicated for me.
So here you are
The program output is