Question: In this assignment, you will implement a doubly-linked list class, together with some list operations. To make things easier, youll implement a list of int,
In this assignment, you will implement a doubly-linked list class, together with some list operations. To make things easier, youll implement a list of int, rather than a template class.
Can you guys, if you want, explain the steps you do to do the operators? Thanks
II Must run in Un) time bool enpty) const; #pragma once dlist.h Doubly-1inked lists of ints private: node* head nullptr; node* tailnullptr; class dlist f public: Add any other private members you need dlist) struct node Inplement ALL the folloving functions* int value node* next; node* prev; Compares two lists for equality, returning true if they have the same elenents in the sase positions. (Hint: it is "not" enough to just compare pointers! You have to compare the values stored In the nodes.) node* head() const return _head; ) node* tail() constreturn tail; ) ust run in O(m) tine, where a is the length of the shorter of the two lists Iaplement ALL the following nethods * bool operator (const dlist& a, const dlist b) Returns the node at a particular index (8 is the head). If n size) // return nullptr; if n
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
