首页 > 代码库 > 链表操作实现类

链表操作实现类

有哪里不对的请指正

#include<iostream>
using namespace std;
struct listNode
{
	int value;
	listNode *next;
	listNode()
	{
		next = NULL;
	}
};
class myList
{
private:
	listNode* head;
	listNode* tail;
public:
	myList()
	{
		head = NULL;
		tail = NULL;
	}
	void insert(listNode *node)
	{
		if(head == NULL)
		{
			head = node;
			tail = node;
		}
		else
		{
			tail->next = node;
			tail = node;
		}
	}
	void insert(int i)
	{
		listNode *new_node = new listNode();
		new_node->value = http://www.mamicode.com/i;>

链表操作实现类