第一次使用链表-如何命名要插入的对象 [英] First time with linked lists - how do I name objects for insertion

查看:95
本文介绍了第一次使用链表-如何命名要插入的对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧

愚蠢的提问时间:

通常,对于数组,我有一个对象名称:object [index] ...如果我有很多对象,那么索引就是将每个对象彼此区分开的地方,希望如此,通常在我的情况下,索引具有一个与对象所代表的现实之间的联系,因此我不必去寻找-第三个第三个​​...

Usually with an array I have an object name: object[index] ...and if I have many of them then the index is what distinguishes each object from each other, hopefully, and usually in my case the index has a connection of to the reality of whatever the object is representing so I don't have to go hunting - the third one is the third one...

现在,我有一项工作需要一个链表作为队列类型(LRU缓存的一部分)-我刚遇到一个问题:

Now I have a job that requires a linked list as kind of queue (part of an LRU cache) - I just hit a question:

我要声明第一个对象并将其添加到链接列表中-但是我怎么称呼它呢?

I'm about to declare the first object and add it to the linked list - but what do I call it ?

对象? ...而且我有很多这样的东西吗?

object ? ...and I have lots of these somehow ?

object1吗? ...如果是这种方式,那我如何在那得到"1"(然后是"2",依此类推)

object1 ? ...if this is the way, then how do I get that '1' there (and then '2' and so on)

我猜测真正的解决方案要么是非常基础的,我就会打自己一个耳光和/或涉及到指针?

I'm guessing the real solution is either really basic and I'll slap myself and/or pointers are involved ?

目前,我只是根据伪代码中的主要算法制定项目,而且每天都会深入细节.我还没有真正学习C ++,并且刚从Java课程学习了一些基本的ADT主题,但是没有实践经验.任何帮助都非常感激.

At the moment I'm just working out the project in terms of major algorithms in pseudoCode and every day go deeper into details. I'm yet to really learn C++ and am coming from a little Java course with and some basic ADT topics, but have no experience in practicalities. Any help really appreciated.

非常感谢!

推荐答案

链接列表对象称为节点,第一个是head.是涉及到指针:)更多信息 http://www.algorithmist.com/index.php/Linked_List

Linked list objects are called nodes, the first one would be head. Yes pointers are involved :) More info http://www.algorithmist.com/index.php/Linked_List

这篇关于第一次使用链表-如何命名要插入的对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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