Simple chained lists

Please help me with these 2 problems. :)
1. In the file "list.txt" there is a string of whole numbers all written on one line, separated by spaces (it is not known how many numbers are in the file).
Create a simple chained linear list of the numbers in the file, then display the largest of these numbers (the maximum of the list keys).
Example. If the file is: 2 -3 8 -1 -7 5
then the list will be created (2 -> -3 -> 8 -> -1 -> -7 -> 5), and the maximum displayed is 8.

2. Consider a simple chained list of integers. Write a subroutine that by a single traversal of the list and without using any other statically allocated data structures, determines both the maximum and minimum keys in the list. The subprogram will receive as a parameter a pointer to the first node of the list. Example:
For the list L=(2 -> -3 -> 7 -> -1 -> 5 -> 1) the minimum -3 and the maximum 7 will be displayed.
Last edited on
Please note that this is not a homework site. We won't do your homework for you. The purpose of homework is that you learn by doing. However we are always willing to help solve problems you encountered, correct mistakes you made in your code and answer your questions.

We didn't see your attempts to solve this problem yourself and so we cannot correct mistakes you didn't made and answer questions you didn't ask. To get help you should do something yourself and get real problems with something. If your problem is "I don't understand a thing", then you should go back to basics and study again.
Topic archived. No new replies allowed.