How JustAnswer Works:

  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.

Ask R.R. Jha Your Own Question

R.R. Jha
R.R. Jha, Tutor
Category: Homework
Satisfied Customers: 5471
Experience:  B.Tech
Type Your Homework Question Here...
R.R. Jha is online now
A new question is answered every 9 seconds

Implement a singly linked list with a header node

This answer was rated:

Implement a singly linked list with a header node, along with a pointer to the header node, but no tail node as a class template named singleList. Include methods to


a. return the size of the linked list,

b. print the linked list,

c. test if a value x is contained in the linked list,

d. add a value x if it is not already contained in the list,

e. remove a value x if it is contained in the linked list.


You need not include iterators or functions begin and end. Include a main function that instantiates a list of integers, singleList, and allows an interactive user to execute any of the five member functions listed above.


I'd be glad to help with your question. I'll work over this and get back to you by tomorrow.

Customer: replied 3 years ago.

Ok thanks

Most welcome!
Hi Shannon,

It's ready. Please download file below

Bonus is appreciated.

Let me know anytime you need help with other problems. Just add 'For RRJha' at the start of new question and I'll get back to you.

R.R. Jha and 4 other Homework Specialists are ready to help you
Customer: replied 3 years ago.

Could you combine it into one file? So instead of a .h file too, there will only be a .cpp file

Ok, I'd do that.

You need to spend $3 to view this post. Add Funds to your account and buy credits.
Customer: replied 3 years ago.

Its working but the problem is

  • it doesn't return the size of the linked list

  • it doesn't test if value x is in the linked list

  • it adds x even if x is already in the list (should only add if not in list)

  • it removes the first node when it should remove x which may not be the first node

I checked again. I'm not encountering any of those errors. Could you please send the screenshot of those error?
If you run the program and choose menu option 4, it would show current size of the list. Function size() of the class does that.

Menu option 3 tests if value x is in the linked list. Function contains() of the class checks that.

Menu option 1 adds an item to the list. If the iterm is already in the list, it doesn't add, but shows the message that item is already present. Function add() of class does that.

Menu option 2 removes the item, if present, from the list. It can remove head or non-head items. Function remove() does that.

Let me know what error are you encountering. I checked again, and it's working correctly here.
Customer: replied 3 years ago.

Customer: replied 3 years ago.

I think it's working now

Yes, the screenshot wasn't from my program. My program had 6 menu choices.

Let me know if I could help with anything else.
Thanks for prompt rating and bonus. If you need help with any other problems in the course, just add 'For RRJha' at the start of your question and I'll get back to you.


Related Homework Questions