- #1
dan2222
- 6
- 0
- Homework Statement
- 'lst' is a linked list that contains different integers from each other. The number of values in the list is even.
Write a method that takes a list, builds a linked list called 'sumq' in which each value includes two of the largest numbers in the list for the set we have not used so far.
It means that one number should not be used more than once. The action must return the 'sumq' list.
For example, the list: lst = {5, 8, 2, -3, 7, 10, 20, 4}
The list that the method will return is: sumq = {30, 15, 9, -1 }
No need to keep the original list.
My own explanation...
It means that the first value of the list 'sumq' is the sum of the 2 largest numbers in the list 'lst' and so on
- Relevant Equations
- -
I could not understand the question, I have really tried to solve it but I could not.
I will appreciate any direction to the solution. Thanks in advance:)
I will appreciate any direction to the solution. Thanks in advance:)