<span style="font-family:Courier New;font-size:14px;">#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
template<typename T>
struct LinkNode
{
T data;
LinkNode* next;
LinkNode(const T& item, LinkNode<T>* ptr=NULL)
{
data=item;
next=ptr;
}
LinkNode(LinkNode<T>* ptr=NULL)
{
next=ptr;
}
};
template<typename T>
class List
{
private:
LinkNode<T> * first;
public:
List()
{
first=NULL;
}
List(const List<T>& L);
List<T>& operator=(const List<T>& L);
~List() {};
void InputFront(const T& elem);
void InputRear(const T& elem);
void MakeEmpty();
void CopyList(const List<T>& L);
bool Insert(int i, const T& x);
bool Remove(int i, T& x);
LinkNode<T>* Search(const T&
不带头结点的单链表代码实现
最新推荐文章于 2024-05-29 18:40:57 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)