Question: Create a class using C++ called LinkedList that represents a doubly linked list. Code the following functions for the class, according to their descriptions. LinkedList

Create a class using C++ called LinkedList that represents a doubly linked list. Code the following functions for the class, according to their descriptions.

LinkedList ()
Default constructor. Constructs an empty list.
LinkedList (std::initializer_list< T > init_list)
Constructs a list with a copy of each of the elements in init_list, in the same order. More...
LinkedList (const LinkedList &another)
Constructs a container with a copy of each of the elements in another, in the same order. More...
~LinkedList ()
Destroys each of the contained elements, and deallocates all memory allocated by this list.
std::size_t Size () const
Returns the number of elements in this list. More...
bool IsEmpty () const
Returns whether the list container is empty (i.e. whether its size is 0). More...
T & Front () const
Returns a reference to the value in the first element in this list. More...
T & Back () const
Returns a reference to the value in the last element in this list. More...
void PushBack (T val)
Appends a new element to this list, after its current last element. More...
void PushFront (T val)
Prepends a new element to this list, before its current first element. More...
void PopFront ()
Deletes the first value in this list. More...
void PopBack ()
Deletes the last value in this list. More...
void Resize (std::size_t n, const T &fill_value)
Resizes the list so that it contains n elements. More...
void Clear ()
Deletes all values in this list.
void Remove (const T &val)
Removes from the container all the elements that compare equal to val. More...
void Unique ()
Removes duplicate values from this list. More...
void Reverse ()
Reverses the order of the elements in this list. More...
LinkedList & operator= (std::initializer_list< T > init_list)
Replaces the contents of this list with a copy of each element in init_list, in the same order. More...
LinkedList & operator= (const LinkedList &another)
Replaces the contents of this list with a copy of each element in another, in the same order. More...
bool operator== (const LinkedList &another)
Compares this list with another for equality. More...
bool operator!= (const LinkedList &another)
Compares this list with another for inequality. More...

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!