Question
Complete the methods of single linked lists // constructor MyLinkedList::MyLinkedList () { this->head = NULL; } // destructor to clean up all nodes MyLinkedList::~MyLinkedList ()
Complete the methods of single linked lists
// constructor MyLinkedList::MyLinkedList () { this->head = NULL; } // destructor to clean up all nodes MyLinkedList::~MyLinkedList () // Check if list is empty or not bool MyLinkedList::empty() const // return the value/elemnt at the front of the lsit const int& MyLinkedList::front() const
// add a node at the front of list void MyLinkedList::addFront(const int& elem) // remove the first node from the list void MyLinkedList::removeFront() // display all nodes of the linked list void MyLinkedList::display() const
//Load data from a file and add it to the Linked List void MyLinkedList::loadData(string path) //write the contents of the list to a file void MyLinkedList::dumpData(string path) const // sort the elments of the list using: Hint use bubble_sort void MyLinkedList::sort()
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