Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Oracle 10g Database Administrator Implementation And Administration

Authors: Gavin Powell, Carol McCullough Dieter

2nd Edition

1418836656, 9781418836658

More Books

Students also viewed these Databases questions

Question

What is behind that?

Answered: 1 week ago

Question

Define Conventional Marketing.

Answered: 1 week ago

Question

Define Synchro Marketing.

Answered: 1 week ago

Question

Define marketing concepts.

Answered: 1 week ago

Question

1 what does yellow colour on the map represent?

Answered: 1 week ago

Question

5-25. Bringing about the destruction of a dream is tragic.

Answered: 1 week ago

Question

5-26. We are of the conviction that writing is important.

Answered: 1 week ago