We know that in linked list we have one value and one pointer (to hold the memory address of next node). Note that it is not compulsory to have only one value. There can be more than one value in one node but pointer will remain one.
Write a C++ program to implement linked list data structure. In this problem every node should have six values, the name of node and a pointer. Your program should prompt the user to enter total number of nodes in the list. After this give the name to node and save 6 different values in node. Process should be repeated for each node.
After entering values of all the nodes, sum the values in each node and sort the list in ascending order (on the basis of sum calculated in each node) i.e. node with smallest sum comes first and node with largest sum comes
Note: Values within a single node should not duplicate. If a user tries to enter any duplicate value WITHIN A
NODE then show a warning message and ask user to enter value again.
The diagram given below is showing the sorted list.
Solution Guidelines:
.1. To save six different values in one node you can use array as data member of Node class.
3. Get the sum of six values and on comparison of sum of different nodes sort the list.
We know that in linked list we have one value and one pointer (to hold the memory address of next node).
Presumably, this means you already know how to write a linked list? And that, therefore, you know how to create a class representing a node in the list that also stores a single value?
The first part should be easy, then - modify your node class to store 6 values and a name, rather than just one value.