Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

c++ please! I need to complete a list of funtions to call for iterator for a cla

ID: 3785468 • Letter: C

Question

c++ please!

I need to complete a list of funtions to call for iterator for a class list for linked class

a functions for each of these please:

//startIterator: moves the iterator to the start of the list

//removeIterator: removes the element currently pointed to by the iterator. Iterator then points to NULL.

//insertIterator: inserts an element after the node currently pointed to by the iterator

//advanceIterator: moves the iterator up by one node

//getIterator: returns the element currently pointed at by the iterator

//offEnd: returns whether the iterator is off the end of the list, i.e. is NULL

//Operator ==: compares two lists to see if they are equal.

this is my private struct:

template <class listdata> //step1 lab2

class List

{

private:

   struct Node

   {

listdata data;

Node* next;

Node* previous;

Node(listdata data): data(data), next(NULL), previous(NULL){}

   };

   typedef struct Node* Nodeptr;

   Nodeptr first;

   Nodeptr last;

   int size;

Explanation / Answer

std::list<int>:: my_list;
std::list<int>::iterator itr;

my_list.push_back(5);

itr = mylist.begin(); //startIterator: moves the iterator to the start of the list

itr = my_list.erase(itr);   //removeIterator: removes the element currently pointed to by the iterator. Iterator then points to NULL.

my_list.insert(itr,10); //insertIterator: inserts an element after the node currently pointed to by the iterator

std::advance (itr,1); //advanceIterator: moves the iterator up by one node

std::next(itr,1); //getIterator: returns the element currently pointed at by the iterator

itr = mylist.end(); //offEnd: returns whether the iterator is off the end of the list, i.e. is NULL

template<class itr1, class itr2>   //Operator ==: compares two lists to see if they are equal.
bool operator==(
const move_iterator<itr1>& _Left,
const move_iterator<itr2>& _Right
);

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote