理解节点和链表概念的问题 [英] Problems understanding concept of nodes and linked list
问题描述
这是教科书的一个示例问题
(i)当将对象obj添加到空的链表中时,指针头会发生什么变化?
head1 = new listNode(obj,head);
(ii)写一个构造函数来表示(i)
溢出是获得一些帮助的地方,我需要一些即时的帮助,所有的想法将深受赞赏。感谢提前
令我困惑的问题是指针和他们指向什么?
在java 引用中,作为指向内存中的对象的指针,内部可以指向另一个对象
我们试着明白 :
当对象obj被添加到空的链表中时,指针头会发生什么?
在下面的快照 head
是指向内存中第一个对象的引用,第一个对象包含指向第二个对象的另一个引用 next
on ...
编写一个构造函数来表示(i)
<我认为你可以做你的h作业
提示:(如上图所示)
- 创建一个新节点
- 点
新节点的
到下一个
- 点
头
到新节点
i am new to Data Structures and Algorithim and i am having some troubles getting around the whole topic of linked list and how its connected to nodes. The problem that is confusing me is with pointers and what they point to
This is a sample question off a textbook
(i) "What happens to the pointer head when the object obj is added to an empty linked list?"
head1 = new listNode(obj, head);
(ii) Write A Constructor to represent (i)
I've seen that stack overflow is the place to get some help, and i need some immediate help, all thoughts will be deeply appreciated. Thanks in Advance
The problem that is confusing me is with pointers and what they point to?
In java reference works as pointer to an object in memory that internally can point to another one in the same way.
Let's try to understand it visually:
What happens to the pointer head when the object obj is added to an empty linked list?
In below snapshot head
is a reference that point to first object in the memory and first object contains another reference next
that points to second object and so on...
Write A Constructor to represent (i)
I think that you can do it as your homework.
Hint: (As shown in above snapshot as well)
- create a new node
- point
next
of new node tonext
of head - point
head
to new node
这篇关于理解节点和链表概念的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!