Implement a singularly linked list class. Complete llist.h, llist.cpp, and client.cpp.

The client/main program is a menu based program:

Case 1:

  • check empty and report the result
  • display the list L.displayAll();
  • add 4 integers L.addRear(1); L.addRear(2); L.addRear(3); L.addRear(4)
  • display the list L.displayAll(); - 1 2 3 4
  • remove from front twice (and display the elements as they are removed)
  • display the list - 3 4
  • check empty again and report the result
  • remove from the rear twice (display the elements removed)
  • check empty again and report the result

Case 2:

  • add to front once (element 5)
  • add to front again (element 4)
  • delete Front -- this removes 4
  • add to rear 3 times (elements 6,8,9)
  • displayAll (4 elements) - 5 6 8 9
  • add before the 1st (element 4) - 4 5 6 8 9
  • add before the 4th (element 7) - 4 5 6 7 8 9
  • add before the 7th (element 10) - 4 5 6 7 8 9 10
  • add before the 9th (element 12) - error (out of range)
  • add before the 0th (element 0) - error (out of range)
  • displayAll - 4 5 6 7 8 9 10
  • delete Ith I==1 (indicate the element removed) - 5 6 7 8 9 10
  • delete Ith I==6 (indicate the element removed) - 5 6 7 8 9
  • delete Ith I==3 (indicate the element removed) - 5 6 8 9
  • delete Ith I==5 - error (out of range)
  • delete Ith I==0 - error (out of range)
  • displayAll - 5 6 8 9
  • delete from rear until it is empty (indicate the elements removed)
  • displayAll - [empty]

Case 3:

  • add before the 0th - error (out of range)
  • delete front - error (underflow)

Case 4:

  • delete 2nd - error (out of range)
  • delete rear - error (underflow)

Note: The above are the minimal required test cases. You should test other error cases thoroughly since this program will be used in later assignments!

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.