哪位大神能帮帮我编写下双向链表这个程序

我是大一的,先修大二课程C++,可这个双向链表程序太难了,有的知识我根本没学过,三天就要交上去,求助攻啊


以下是要求:

题目:双向链表的实现

要求

链表元素中要有指针指向动态分配的内存空间,练习析构函数的操作规则

链表应该至少有两个类,Node类和List类, Node类的构造和析构函数负责结点本身的初始化和空间回收,List类负责整个链表的管理工作,其构造和析构函数负责整个链表的初始化和回收

List类派生出StackQueue,并使其具有自身的操作特性,练习派生类的概念 

List类派生出Set类,负责集合操作的实现 

要求:具有差“—”,并”+union,交and三种操作,其中前两个是运算符的重载,第三个并非运算符的重载

 练习要点:理解并、交、差操作并不影响参与操作的集合,实现并交差操作

构造函数:

CListConstructs an empty ordered list.

获得头/尾指针

GetHeadReturns the head element of the list

GetTailReturns 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.

插入操作

InsertBeforeInserts a new element before a given position.

InsertAfterInserts a new element after a given position.

查询操作

FindGets the position of an element specified by pointer value.

FindIndexGets the position of an element specified by a zero-based index.

状态测试

GetCountReturns the number of elements in this list.

IsEmptyTests for the empty list condition (no elements).

 


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值