Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Dental Assisting

Authors: Doni Bird, Debbie Robinson

13th Edition

978-0323624855, 0323624855

Students also viewed these Programming questions