Question
//MAIN FUNCTION #include #include LinkedList.h int main(int argc, const char * argv[]) { std::cout < < Hello, World! ; LinkedNode * head = new LinkedNode
//MAIN FUNCTION
#include
int main(int argc, const char * argv[]) { std::cout << "Hello, World! "; LinkedNode
include
#include
#include
#include
#include
#include
using namespace std;
#ifndef LinkedList_h
#define LinkedList_h
#endif /* LinkedList_h */
// need compar function so we can swap generic things
template
class LinkedNode
{
protected:
// link to next node
LinkedNode
T nodeValue;
int nodeKey=0;
void splitList(LinkedNode
LinkedNode
void swapNodes(LinkedNode
public:
//ctor
LinkedNode(T value,
LinkedNode
int key=0)
{
next= next_node;
nodeValue = value;
nodeKey = key;
}
// ** Getters **
const T getValue() {return nodeValue;}
//read-only node key
const int getKey() {return nodeKey;}
// link to next node
LinkedNode
// ** Setters **
void setNext(LinkedNode
// Prints all items in the list,
// starting from current node.
void printList();
// returns a reference to the nth node in the list
LinkedNode
// performs a merge sort, and returns new head
void doMergeSort();
void doMergeSort(LinkedNode
};
Do not need to implement all of the functions. Please implement the following functions so that the merge sort works, including
doMergeSort()
doMergeSort(LinkedNode
splitList(LinkedNode
LinkedNode
void printList();
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