Question: C++ Improving previous assignment. List.hpp [ https://pastebin.comXgAFawk ] LinkedList.hpp [ https://pastebin.com/gm7zc4iy ] ArrayList.hpp [ https://pastebin.com/VHpwcEfY ] main.cpp [ https://pastebin.com/fzpQvs7D ] DoublyList.hpp [ https://pastebin.com/K6w5J6qd ] Improving
C++ Improving previous assignment.
![C++ Improving previous assignment. List.hpp [ https://pastebin.comXgAFawk ] LinkedList.hpp [ https://pastebin.com/gm7zc4iy ]](https://s3.amazonaws.com/si.experts.images/answers/2024/08/66b71f0f5935b_07066b71f0ef1d1a.jpg)
![ArrayList.hpp [ https://pastebin.com/VHpwcEfY ] main.cpp [ https://pastebin.com/fzpQvs7D ] DoublyList.hpp [ https://pastebin.com/K6w5J6qd ]](https://s3.amazonaws.com/si.experts.images/answers/2024/08/66b71f0feeab2_07166b71f0f8f974.jpg)
List.hpp [ https://pastebin.comXgAFawk ]
LinkedList.hpp [ https://pastebin.com/gm7zc4iy ]
ArrayList.hpp [ https://pastebin.com/VHpwcEfY ]
main.cpp [ https://pastebin.com/fzpQvs7D ]
DoublyList.hpp [ https://pastebin.com/K6w5J6qd ]
Improving the Linked Lists Thus far, our linked lists have only kept track of their head (the first node in the list). But, we can actually improve their performance if we also keep track of the last node. That's your task for this homework assignment. You will need to modify the Linked List and DoublyList class templates to include an additional attribute for the last node. Having access to the end of the list can simplify certain algorithms; it's your job to find out which ones. You also need to provide an asymptotic analysis for each method! Lastly, for Linked List and DoublyList, implement a new method: void reverse() This method should reverse the elements in the list. You will also need to provide an asymptotic analysis for it (analyze the number of assignment operations). Download this.zip file that contains the List abstract class, ArrayList class, LinkedList class, and a main file. Download this other.zip file that contains the DoublyList class. Sample Session Once you are ready to test your implementation, simply run my main file. This file contains code that is going to test your improved LinkedList and DoublyList class templates against my ArrayList class template. The following is a sample session of the evaluations. Note, because the tests use randomness, you will likely have different results: Elapsed time for appending in array-based list: 0.0014004 Elapsed time for appending in singly linked list: 0.0036593 Elapsed time for appending in doubly linked list: 0.0031271 Elapsed time for inserting randomly in array-based list: 1.01411 Elapsed time for inserting randomly in singly linked list: 3.59708 Elapsed time for inserting randomly in doubly linked list: 1.781 Elapsed time for inserting to the front of array-based list: 3.37454 Elapsed time for inserting to the front of singly linked list: 0.003575 Elapsed time for inserting to the front of doubly linked list: 0.003589 Elapsed time for inserting to the back of array-based list: 0.0047268 Elapsed time for inserting to the back of singly linked list: 31.4521 Elapsed time for inserting to the back of doubly linked list: 0.0113713 Elapsed time for reversing the array-based list: 0.0272957 Elapsed time for reversing the singly linked list: 0.0272957 Elapsed time for reversing the doubly linked list: 0.001379 Elapsed time for replacing randomly in array-based list: 0.0183085 Elapsed time for replacing randomly in singly linked list: 72.7302 Elapsed time for replacing randomly in doubly linked list: 24.4052 Elapsed time for replacing the front-half of array-based list: 0.0054821 Elapsed time for replacing the front-half of singly linked list: 10.1443 Elapsed time for replacing the front-half of doubly linked list: 10.2869 Elapsed time for replacing the back-half of array-based list: 0.0077523 Elapsed time for replacing the back-half of singly linked list: 53.8325 Elapsed time for replacing the back-half of doubly linked list: 8.63379 Elapsed time for removing randomly in array-based list: 3.37494 Elapsed time for removing randomly in singly linked list: 20.5109 Elapsed time for removing randomly in doubly linked list: 7.26562 Elapsed time for removing the front of array-based list: 3.97741 Elapsed time for removing the front of singly linked list: 0.0071117 Elapsed time for removing the front of doubly linked list: 0.0059946 Elapsed time for removing the back of array-based list: 3.97908 Elapsed time for removing the back of singly linked list: 4.71504 Elapsed time for removing the back of doubly linked list: 0.0123858 Submission You will be submitting a single.zip file that contains your improved LinkedList and DoublyList implementations. Improving the Linked Lists Thus far, our linked lists have only kept track of their head (the first node in the list). But, we can actually improve their performance if we also keep track of the last node. That's your task for this homework assignment. You will need to modify the Linked List and DoublyList class templates to include an additional attribute for the last node. Having access to the end of the list can simplify certain algorithms; it's your job to find out which ones. You also need to provide an asymptotic analysis for each method! Lastly, for Linked List and DoublyList, implement a new method: void reverse() This method should reverse the elements in the list. You will also need to provide an asymptotic analysis for it (analyze the number of assignment operations). Download this.zip file that contains the List abstract class, ArrayList class, LinkedList class, and a main file. Download this other.zip file that contains the DoublyList class. Sample Session Once you are ready to test your implementation, simply run my main file. This file contains code that is going to test your improved LinkedList and DoublyList class templates against my ArrayList class template. The following is a sample session of the evaluations. Note, because the tests use randomness, you will likely have different results: Elapsed time for appending in array-based list: 0.0014004 Elapsed time for appending in singly linked list: 0.0036593 Elapsed time for appending in doubly linked list: 0.0031271 Elapsed time for inserting randomly in array-based list: 1.01411 Elapsed time for inserting randomly in singly linked list: 3.59708 Elapsed time for inserting randomly in doubly linked list: 1.781 Elapsed time for inserting to the front of array-based list: 3.37454 Elapsed time for inserting to the front of singly linked list: 0.003575 Elapsed time for inserting to the front of doubly linked list: 0.003589 Elapsed time for inserting to the back of array-based list: 0.0047268 Elapsed time for inserting to the back of singly linked list: 31.4521 Elapsed time for inserting to the back of doubly linked list: 0.0113713 Elapsed time for reversing the array-based list: 0.0272957 Elapsed time for reversing the singly linked list: 0.0272957 Elapsed time for reversing the doubly linked list: 0.001379 Elapsed time for replacing randomly in array-based list: 0.0183085 Elapsed time for replacing randomly in singly linked list: 72.7302 Elapsed time for replacing randomly in doubly linked list: 24.4052 Elapsed time for replacing the front-half of array-based list: 0.0054821 Elapsed time for replacing the front-half of singly linked list: 10.1443 Elapsed time for replacing the front-half of doubly linked list: 10.2869 Elapsed time for replacing the back-half of array-based list: 0.0077523 Elapsed time for replacing the back-half of singly linked list: 53.8325 Elapsed time for replacing the back-half of doubly linked list: 8.63379 Elapsed time for removing randomly in array-based list: 3.37494 Elapsed time for removing randomly in singly linked list: 20.5109 Elapsed time for removing randomly in doubly linked list: 7.26562 Elapsed time for removing the front of array-based list: 3.97741 Elapsed time for removing the front of singly linked list: 0.0071117 Elapsed time for removing the front of doubly linked list: 0.0059946 Elapsed time for removing the back of array-based list: 3.97908 Elapsed time for removing the back of singly linked list: 4.71504 Elapsed time for removing the back of doubly linked list: 0.0123858 Submission You will be submitting a single.zip file that contains your improved LinkedList and DoublyList implementations
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
