Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a C++ function that starts with a single linked list of items and a specia

ID: 3667846 • Letter: W

Question

Write a C++ function that starts with a single linked list of items and a special value called the splitting value. Two item values can be comparred using the < operator- but the items of the original linked list are in no particular order. The procedure divides the nodes into two linked lists: one containing alll the nodes that contain an item less than the splitting value, and one that contains all the other nodes. If the original linked list had any repeated items integers (i.e, any two or more nodes with the same item in them) then the new linked list that has this item should have the same number of nodes that repeat this item. It does not matter whether you preserve the original linked list or destroy it in the process of building the two new lists, but your comments should documents what happens to the original linked list.

node1.h: http://pastebin.com/TRp1xXrt

node1.cpp: http://pastebin.com/mYwFk4Ne

Explanation / Answer

Hi, I have used my node structure and all other things. I have written full program to split a linked list into two parts based on a value. I have preserved original linked list in my code. #include #include #include using namespace std; struct node{ int data; node * link; }; // These are the three I have written for you void build_list(node* & head); // note that we are passing by reference void show_list(const node* head); int size(const node* head); void remove_repeats(node*& head); void split_list(const node* original, node*& lesser, node*& greater,int split_value); int main(){ int start, stop; int split; node* head = NULL; node *lesser; node * greater; start = time(NULL); build_list(head); stop = time(NULL); cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote