Question
The objective of this assignment is to implement several basic methods for a singly linked list. I have provided declaration files for the Node and
The objective of this assignment is to implement several basic methods for a singly linked list. I have provided declaration files for the Node and LinkedList classes. ( see node.h and linkedlist.h ).
Implement the following LinkedList methods in linkedlist.cpp:
void add ( int N ) Add N to the front of the linked list.
bool remove ( int N ) Remove the first instance of N from the list, then return true. If the N was not found, return false.
int find ( int N ) Find the first instance of N in the list and return its index. Return -1 if N was not found.
int count ( int N ) Return a count of the instances of N in the list.
int at ( int N ) Return the value stored in the node at index N.
int len() Return the current length of the list.
You can use main.cpp for your own internal testing. Make sure you do not alter the order of elements in the list.
Do NOT make any changes to node.h file or the linkedlist.h file
Current file: main.cpp 1 #includeStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started