Question
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.
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 ininit_list, in the same order.
LinkedList(constLinkedList&another)
Constructs a container with a copy of each of the elements inanother, in the same order.
~LinkedList()
Destroys each of the contained elements, and deallocates all memory allocated by this list.
std::size_tSize() const
Returns the number of elements in this list.More...
boolIsEmpty() const
Returns whether the list container is empty (i.e. whether its size is 0).
T &Front() const
Returns a reference to the value in the first element in this list.
T &Back() const
Returns a reference to the value in the last element in this list.
voidPushBack(T val)
Appends a new element to this list, after its current last element.
voidPushFront(T val)
Prepends a new element to this list, before its current first element.
voidPopFront()
Deletes the first value in this list.
voidPopBack()
Deletes the last value in this list.
voidResize(std::size_t n, const T &fill_value)
Resizes the list so that it containsnelements.
voidClear()
Deletes all values in this list.
voidRemove(const T &val)
Removes from the container all the elements that compare equal toval.
voidUnique()
Removes duplicate values from this list.
voidReverse()
Reverses the order of the elements in this list.
LinkedList&operator=(std::initializer_list< T > init_list)
Replaces the contents of this list with a copy of each element ininit_list, in the same order.
LinkedList&operator=(constLinkedList&another)
Replaces the contents of this list with a copy of each element inanother, in the same order.
booloperator==(constLinkedList&another)
Compares this list with another for equality.
booloperator!=(constLinkedList&another)
Compares this list with another for inequality.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started