带有节点的LinkedList [英] LinkedList with Nodes

查看:78
本文介绍了带有节点的LinkedList的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




i我正在创建一个LinkedList,为此我使用了一个预定义的Node-class,它提供了一个LinkedList Toolkit来操作

链接列表( http ://www.cs.colorado.edu/~main/chapter5/node1.h)。我是
开发一个Squence-Class,它应该在

LinkedList中存储一系列数字。


我的序列头文件看起来像这样,分别是方法

和变量:

Hi,

i am currently working on creating a LinkedList, for that I using a
predefined Node-class which offers a LinkedList Toolkit to manipulate
the Linked List (http://www.cs.colorado.edu/~main/chapter5/node1.h). I
develop a Squence-Class which should store a sequence of numbers in a
LinkedList.

My header file of sequence looks like this, respectively the methods
and variables:

展开 | 选择 | Wrap | 行号

推荐答案

2006年10月18日08:30:36 -0700 comp.lang.c ++, ma****@gmx.at 写道,
On 18 Oct 2006 08:30:36 -0700 in comp.lang.c++, ma****@gmx.at wrote,

>根据规范,insert函数应该在节点之前插入一个节点
当前光标指向的位置。因此,我在光标指向的节点之前指向节点的前体,但我不明白我怎么能找到这个
位置...... :((
>According to the specification the insert function should insert a node
before the node which the current cursor points to. So therefore I have
to point with the precursor to the node before the node the cursor
points to, but I do not understand how i can find out this
position...:((



你从之前插入的现有节点的前体中得到它(在使用指针破坏该值之前)

插入的节点!)

You get it from the "precursor" of the existing node that you are
inserting before (before clobbering that value with the pointer to
the inserted node!)




是的我必须让前体指向光标指针指向的前一个节点




但是如何设置前一个节点的前驱指针 - 节点

在光标所指向的节点之前?


matti


PS:抱歉,但我不是''理解你的意思是什么意思,

不幸的是我不是英语母语人士而且我的字典给了我一些奇怪的翻译...:/ /


Yes I have to let the precursor point to the previous node before the
one to which the cursor pointer points to.

but how can I set the precursor pointer to the previous node - the node
before the node to which the cursor points to?

matti

PS: sorry but I don''t understand what do you mean with clobbering,
unfortunately i am not an english native speaker and my dictionary gave
me some strange translations for that word..:-/

2006年10月18日09:20:09 -0700 comp.lang.c ++, ma **** @ gmx。在写道,
On 18 Oct 2006 09:20:09 -0700 in comp.lang.c++, ma****@gmx.at wrote,

>
是的我必须让前体指向上一个节点之前的
一个光标指针指向。

但是如何设置前一个节点的前体指针 - 光标所指向的节点之前的节点?
>
Yes I have to let the precursor point to the previous node before the
one to which the cursor pointer points to.

but how can I set the precursor pointer to the previous node - the node
before the node to which the cursor points to?



光标指向的节点的前体指针是你需要的



现有列表节点中的前体指针形成一个后面的指向链,你可以根据需要向后追踪。

The precursor pointer of the node the cursor points to is what you
need.

The precursor pointers in the nodes of the existing list form a back
pointing chain, that you can follow backwards as far as you need to.


> PS:抱歉,但我不明白你的意思是什么意思,
不幸的是我不是英语母语人士而且我的字典给了我一些奇怪的翻译。 。: - /
>PS: sorry but I don''t understand what do you mean with clobbering,
unfortunately i am not an english native speaker and my dictionary gave
me some strange translations for that word..:-/



对不起。我的意思是,当你插入节点时,你将改变现有节点的前体指针指向新节点,

但你需要保存更改之前指针的旧值

它。那个旧值是你找到前一个节点所需要的值。


是的,这是一个奇怪的词。我自己无法定义。

Sorry. By that I mean, when you insert the node, you will change
the precursor pointer of the existing node to point to the new node,
but you need to save the old value of the pointer before you change
it. That old value is the one you need to find the previous node.

Yes, it''s a strange word. I could not define it myself.


这篇关于带有节点的LinkedList的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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