Chat with us, powered by LiveChat PART A – Smart Pointers. 10 points - For each of the follo | Wridemy

PART A – Smart Pointers. 10 points – For each of the follo

PART A – Smart Pointers. 10 points – For each of the following statements, please: ▪Explain the statement in 5 or more sentences. And ▪Create a code experiment to demonstrate our understanding. ▪Please remember to submit our code and document our experiment in our assignment report. 1. Deleting the same memory twice: This error can happen when two pointers address the same dynamically allocated object. If delete is applied to one of the pointers, then the object’s memory is returned to the Free-store. If we subsequently delete the second pointer, then the Free-store may be corrupted. 2. Use smart pointers… Objects that must be allocated with new, but you like to have the same lifetime as other objects/variables on the Run-time stack. Objects assigned to smart pointers will be deleted when program exits that function or block. 3. Use smart pointers… Data members of classes, so when an object is deleted all the owned data is deleted as well (without any special code in the destructor). 4. Converting unique_ptr to shared_ptr is easy. Use unique_ptr first and covert unique_ptr to shared_ptr when needed. 5. Use weak_ptr for shared_ptr like pointers that can dangle. PART B – Linked Bag. 20 points – Please change only files: LinkedBag340.cpp and Include.h, no other files. – We are to implement 8 small additional functions and 2 helper functions to the Linked Bag. – Our programs must produce identical output to the output in the 2 sample runs: Asmt03_Run1.txt and Asmt03_Run2.txt ▪Our Test 9’s output must also be identical to the sample output excepts the random values. ▪Our Test 9’s random values in our 2 sample runs’ output must be different. Descriptions of the 8 functions: Please ask questions, if any, during the in-class discussions and demos for this assignment. 1. removeSecondNode340 deletes the second node in the Linked Bag. 2 pts 2. addEnd340 inserts the new node at the end of the Linked Bag. 2 pts 3. getCurrentSize340Iterative counts the number of nodes in the Linked Bag iteratively. 2 pts 4. getCurrentSize340Recursive counts the number of nodes in the Linked Bag recursively. Use 1 helper function: getCurrentSize340RecursiveHelper. 2 pts 5. IMMEDIATE RECURSION: getCurrentSize340RecursiveNoHelper counts the number of nodes in the Linked Bag recursively. This recursive function does not use any helper functions. 4 pts 6. getFrequencyOf340Recursive recursively counts the number of times an entry appears in the Linked Bag. Use 1 helper function: getFrequencyOf340RecursiveHelper. 2 pts 7. IMMEDIATE RECURSION: getFrequencyOf340RecursiveNoHelper recursively counts the number of times an entry appears in the Linked Bag. This recursive function does not use any helper functions. 4 pts 8. removeRandom340 removes a random entry from the Linked Bag. 2 pts PART C – Linked Bag, Smart Pointers Version. 10 points – Create a Smart Pointers version of your PART B’s Linked Bag: 1. Please create a copy of your entire PART B solution and name it: PartB_SmartPointers. 2. Then go through all the files, not just LinkedBag340.cpp, and use smart pointers properly where it is possible. 3. In your assignment report, list the file names and the line numbers in which you use smart pointers. For each smart pointer, explain in 3 or more sentences why it is a proper use. 4. This Smart Pointers version must work properly and produce identical output like that of your PART B version. 5. Please add a destructor so that the program displays when object(s) get destroyed. 6. Please remember to submit your code of this part. Save the code under a folder named “PartB_SmartPointers” and include this folder in the assignment submission ZIP. Please remember to document this part in the assignment report.

Our website has a team of professional writers who can help you write any of your homework. They will write your papers from scratch. We also have a team of editors just to make sure all papers are of HIGH QUALITY & PLAGIARISM FREE. To make an Order you only need to click Ask A Question and we will direct you to our Order Page at WriteDemy. Then fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.

Fill in all the assignment paper details that are required in the order form with the standard information being the page count, deadline, academic level and type of paper. It is advisable to have this information at hand so that you can quickly fill in the necessary information needed in the form for the essay writer to be immediately assigned to your writing project. Make payment for the custom essay order to enable us to assign a suitable writer to your order. Payments are made through Paypal on a secured billing page. Finally, sit back and relax.

Do you need an answer to this or any other questions?

About Wridemy

We are a professional paper writing website. If you have searched a question and bumped into our website just know you are in the right place to get help in your coursework. We offer HIGH QUALITY & PLAGIARISM FREE Papers.

How It Works

To make an Order you only need to click on “Order Now” and we will direct you to our Order Page. Fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.

Are there Discounts?

All new clients are eligible for 20% off in their first Order. Our payment method is safe and secure.

Hire a tutor today CLICK HERE to make your first order

Related Tags

Academic APA Writing College Course Discussion Management English Finance General Graduate History Information Justify Literature MLA