Question: Assignment 3 (Programming): Comparison of the Singly and Doubly Linked List-based Implementations of the Stack ADT Due by: March 2nd, 11.59 PM You are given










Assignment 3 (Programming): Comparison of the Singly and Doubly Linked List-based Implementations of the Stack ADT Due by: March 2nd, 11.59 PM You are given the singly linked list and doubly linked list-based implementations of the Stack ADT. The singly linked list-based implementation treats the head end of the list as the top of the stack and accordingly pushes and pops near the head node of the list. The doubly linked list-based implementation (named as: DoublyLinkedList_Stack_TailPushPop.cpp) considers the tail end of the list as the top of the stack and the push and pop operations are performed with regards to the node previous to the tail node. Your task in this project is to implement the Stack ADT using a doubly linked list-implementation wherein the head end of the list is considered as the top of the stack and the push and pop operations are performed with regards to the node next to the head node. In this pursuit, you are required to modify the code for the following member functions of the class Stack in the DoublyLinkedList_Stack_TailPushPop.cpp file to reflect the above requirement and name the.cpp file as DoublyLinkedlist_Stack_HeadPushPop.cpp. push, pop. peck, PrintTop ToBottom, PrintBottomToTop In both the .cpp files corresponding to the singly linked list and (tail end-based) doubly linked list implementations, the main function has the code to create and maintain a stack of a certain number of randomly generated integers (StackSize), each within the range of [...maxValue). The timers are setup to measure the time to push all the StackSize amount of the integers to the Stack and pop all of them out. The above trials are run numTrials number of times and the average push time and average pop time in micro seconds are then determined. You could retain the main function as it is (provided in the DoublyLinkedList_Stack_TailPushPop.cpp file) in the DoublyLinkedList_Stack_HeadPushPop.cpp file that you will be developing. There is no need to change anything in the singly linked list-based implementation and you could use it just for reference and performance comparison purposes. After you implement the DoublyLinkedList_Stack_HeadPushPop.cpp file (as directed above), you could run this file as well as the DoublyLinkedlist_Stack_TailPushPop.cpp file and the singly linked list-based SinglyLinkedList_Stack.cpp file for the following values of the input variables. Tabulate all your results for the pushing time and popping time that will be printed in micro seconds) StackSize: 100000 and 1000000 max Value: 50000 numTrials = 10 Interpret your results; explain the similarity or differences (as you observe in the results) and come to a conclusion Submission: (1) The DoublyLinkedList_Stack_HeadPushPop.cpp file that implements the Stack ADT using a doubly linked list wherein the head end of the list is considered as the top of the stack. (2) A PDF or Word file containing the table of results (as described above) and the interpretation of the results. #include
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
