[SOLVED] CECS282 Homework 5-A Link Between Worlds

30.00 $

Category:
Click Category Button to View Your Next Assignment | Homework

You will receive the following solution file(s) instantly after successful payment:

zip file icon Homework_5-3ocmkg.zip (54.4 KB)
Assignment Instructions Updated Recently? Submit Below and we will provide new Solution!
Submit New Instructions
šŸ”’ Securely Powered by:
Secure Checkout
Rate this product

 

In this homework, you will program a singly-linked list of integers similar to the linked stacks from lecture. You will use modern C++ memory management via the unique_ptr class found in the <memory> library. You can use the ModernLinkedStack as inspiration, but will need to add a few more methods to it.

Assignment

Copy the ō°ƒles ModernLinkedList.h and ModernLinkedList.cpp from the GitHub repository, then make a new project with those ō°ƒles. Review the ō°ƒles so you’re clear on what instance variables and methods are expected on this type, then begin to implement the methods from the .h ō°ƒle as described. Some notes:

  1. The procedure for adding a new element can be diō°‚erent depending on whether the list is currently empty. You can use the current mSize to determine if the list is empty.
  2. The existing PrintList and PopBack functions shows an example of ō°€walkingō° through the nodes of the list. You will need to do something similar for PushBack, Insert and RemoveAt, and operator[]. (operator[] is equivalent to the ō°€getō° function from Java’s linked lists ō°… it returns the data element at the given index.)
  3. You should write a main to test your list. Add and remove some elements, and use PrintList to periodically check the correctness of the list.
  4. If you do this correctly, you will never have to use new or delete ō°… that’s the entire purpose of the unique_ptr type.

Deliverables Hand in:

1. ModernLinkedList.cpp and your main.cpp. Submit to Dropbox.

1

  • Homework_5-3ocmkg.zip