Write a linked implementation of a list where each list nodeelement contains pointers to both the previous and next element inthe list. (C++)
// ListNode.h
#ifndef _LISTNODE_H
#define _LISTNODE_H
#include <cstdlib>
typedef int ItemType;
class ListNode {
friend class LList;
public:
ListNode(ItemType item, ListNode* link = NULL);
private:
ItemType item_;
ListNode *link_;
};
inline ListNode::ListNode(ItemType item, ListNode *link)
{
item_ = item;
link_ = link;
}
#endif // _LISTNODE_H
// LList.h
#ifndef _LLIST_H
#define _LLIST_H
#include “ListNode.h”
class LList {
public:
LList(); // sonstructor
LList(const LList& source); // copyconstructor
~LList(); // destructor
LList& operator=(const LList& source); //assignment operator
int size() { return size_; } // size method
void append(ItemType x); // append operator
void insert(size_t i, ItemType x); // insertionoperator