Question
This assignment should be complete in C++ code The starter code provided implements a singly-linked list. However, as a singly-linked list, it lacks any ability
This assignment should be complete in C++ code
The starter code provided implements a singly-linked list. However, as a singly-linked list, it lacks any ability to push or pop items at the back of the list. This is inconvenient. Please modify this data structure to so it is a doubly-linked list.
To Do: Node.h
Add a pointer to the previous Node (1pt)
Add the ability to get the previous Node (1pt)
Add the ability to set the previous Node pointer (1pt)
To Do: LinkedList.h
Add a pointer to the tail, the last item in the list (1pt)
Create a method to push items onto the back of the list (3 pts)
Create a method to pop items off of the back of the list (3pts)
To Do: main.cpp
-
Demonstrate that your pushBack and popBack methods work (2 pts)
Make sure you include comments
The starter code is listed bellow
#include
#include "LinkedList.h" int main() { LinkedList myList; for(int i = 0; i < 10; i++) { myList.pushFront(i+1); } myList.print(); }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started