Question: please help this is c++ these functions have NO PARAMETERS Move the first two nodes (or more) to the end of the calling object. This
please help this is c++ these functions have NO PARAMETERS
- Move the first two nodes (or more) to the end of the calling object. This will require resetting pointer first, and last if it is a doubly-linked list, and all other necessary pointers to connect the list.
- Move the last two nodes (or more) to the front of the calling object. This will require resetting pointer first, and last if it is a doubly-linked list, and all other necessary pointers to connect the list.
- Search for specific values (all odds, all evens, all multiples of some integer, etc.) and return the number of occurrences.
- Search for specific values (all odds, all evens, all multiples of some integer, etc.) and add a node at the end (or beginning) of the list. The node will store the number of occurrences.
- Search for specific values (all odds, all evens, all multiples of some integer, etc.) and return true if at least one occurrence of that specific value is found.
- Rotate a list to the left (or right) by rotating the nodes. You will need to reset pointers.
- Rotate a list to the left (or right) by rotating the values stored in the nodes. No pointers will be reset.
___________________________________________________
class Node { public: Node() : data(0), next(nullptr) {} Node(int theData, Node *newNext) : data(theData), next(newNext){} Node* getNext() const { return next; } int getData( ) const { return data; } void setData(int theData) { data = theData; } void setNext(Node *newNext) { next = newNext; } ~Node(){} private: int data; Node *next; // Pointer that points to next node. };
class AnyList { public: AnyList() : first(nullptr), count(0) {}
void print() const;
void clearList(); ~AnyList();
private: Node *first; // Pointer to point to the first node in the list. int count; // Variable to keep track of number of nodes in the list. };
#endif
if possible these functions could be doubly linked list thank you
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
