哪位大神能帮帮我编写下双向链表这个程序
2014-05-28 20:56
246 查看
我是大一的,先修大二课程C++,可这个双向链表程序太难了,有的知识我根本没学过,三天就要交上去,求助攻啊
以下是要求:
题目:双向链表的实现
要求
链表元素中要有指针指向动态分配的内存空间,练习析构函数的操作规则
链表应该至少有两个类,Node类和List类, Node类的构造和析构函数负责结点本身的初始化和空间回收,List类负责整个链表的管理工作,其构造和析构函数负责整个链表的初始化和回收
从List类派生出Stack和Queue,并使其具有自身的操作特性,练习派生类的概念
从List类派生出Set类,负责集合操作的实现
要求:具有差“—”,并”+”union,交and三种操作,其中前两个是运算符的重载,第三个并非运算符的重载
练习要点:理解并、交、差操作并不影响参与操作的集合,实现并交差操作
构造函数:
CList:Constructs an empty ordered list.
获得头/尾指针
GetHead:Returns the head element of the list
GetTail:Returns the tail element of the list
链表元素操作
RemoveHead :Removes the element from the head of the list.
RemoveTail :Removes the element from the tail of the list.
AddHead :Adds an element (or all the elements in another list) to the head of the list (makes a new head). 函数重载
AddTail :Adds an element (or all the elements in another list) to the tail of the list (makes a new tail). 函数重载
RemoveAll : Removes all the elements from this list.
Operator+() 运算符重载函数
遍历操作
GetNext Gets the next element for iterating.
GetPrevGets the previous element for iterating.
检索/修改操作
GetAt Gets the element at a given position.
SetAt Sets the element at a given position.
RemoveAt Removes an element from this list, specified by position.
插入操作
InsertBefore:Inserts a new element before a given position.
InsertAfter:Inserts a new element after a given position.
查询操作
Find:Gets the position of an element specified by pointer value.
FindIndex:Gets the position of an element specified by a zero-based index.
状态测试
GetCount:Returns the number of elements in this list.
IsEmpty:Tests for the empty list condition (no elements).
以下是要求:
题目:双向链表的实现
要求
链表元素中要有指针指向动态分配的内存空间,练习析构函数的操作规则
链表应该至少有两个类,Node类和List类, Node类的构造和析构函数负责结点本身的初始化和空间回收,List类负责整个链表的管理工作,其构造和析构函数负责整个链表的初始化和回收
从List类派生出Stack和Queue,并使其具有自身的操作特性,练习派生类的概念
从List类派生出Set类,负责集合操作的实现
要求:具有差“—”,并”+”union,交and三种操作,其中前两个是运算符的重载,第三个并非运算符的重载
练习要点:理解并、交、差操作并不影响参与操作的集合,实现并交差操作
构造函数:
CList:Constructs an empty ordered list.
获得头/尾指针
GetHead:Returns the head element of the list
GetTail:Returns the tail element of the list
链表元素操作
RemoveHead :Removes the element from the head of the list.
RemoveTail :Removes the element from the tail of the list.
AddHead :Adds an element (or all the elements in another list) to the head of the list (makes a new head). 函数重载
AddTail :Adds an element (or all the elements in another list) to the tail of the list (makes a new tail). 函数重载
RemoveAll : Removes all the elements from this list.
Operator+() 运算符重载函数
遍历操作
GetNext Gets the next element for iterating.
GetPrevGets the previous element for iterating.
检索/修改操作
GetAt Gets the element at a given position.
SetAt Sets the element at a given position.
RemoveAt Removes an element from this list, specified by position.
插入操作
InsertBefore:Inserts a new element before a given position.
InsertAfter:Inserts a new element after a given position.
查询操作
Find:Gets the position of an element specified by pointer value.
FindIndex:Gets the position of an element specified by a zero-based index.
状态测试
GetCount:Returns the number of elements in this list.
IsEmpty:Tests for the empty list condition (no elements).
相关文章推荐
- 这个是今天上课自己编写的链表的程序。
- 双向链表小练习--》无头尾标识位的双向链表,这个练习为之后的循环链表编写做准备
- 利用模板类编写一个程序,实现双向链表的插入、删除、查找、显示的功能。
- 用C语言编写一个包含链表的初始化、插入、删除、查找等基本操作的程序。
- 双向循环链表删除算法的C++程序实现
- uva133 利用指针编写双向循环链表
- 新手求大神,有其他swit-case的思路写这个程序么?
- 上班时候,老被腾讯弹出来的新闻打扰,很少烦恼,于是编写了一小程序,用于彻底解决这个问题,并代码开源,以防杀毒软件告诉你是病毒
- 哪位高人知道这个程序是用什么编的啊?(曾获得奖项的程序)我非常想学它
- 编写一个linux内核模块,用以创建、增加、删除、和遍历一个双向链表
- 《c primer pius》第十章第6题,编写一个程序,初始化一个二维double数组,并利用练习2中的任一函数来把这个数组复制到另一个二维数组(因为二维数组是数组的数组,所以可以使用处理一维数组的
- 编写一个C语言语句,要求输出这个程序需要运行的时间(用clock()做) 该怎么写?
- 双向循环链表插入算法的C++程序实现
- 1.1至100一百个自然数(无序),放入一个99个元素的数组a[99],用java语言编写一段程序,找出没有被放入数组这个数。【转】
- 编写opencv程序的小心这个漏洞
- 3.有一个整形数组,只有一个数字出现了一次,请编写程序判断这个数字(大概题目就是这样的,记不太清了)
- 这个VB.NET程序老难了,哪位高手能帮下忙看看,解释下错误,改正下,实在是太感谢了
- 编写一个程序来计算这两个序列不断变化的总和,直到达到某个次数。让用户交互地输入这个次数。
- 有哪位大神知道这个地图的框架是怎么实现的
- 这个程序中为什么出错???为什么不能把nl,nr定义为全局变量,求大神指教