Good afternoon.
I ran into some problems. I can solve it, but I have little experience in programming, and it seems to me that there is a more beautiful and rational solutions to this problem.
The problem is as follows. Given a set of text files with a total size of more than one hundred megabytes. The number of files from 2 to N. Files contain sorted unique numbers (for example, IDs). It wanted to merge all the numbers in one output file. Inside the resulting file numbers also need to be sorted.
I'm going to solve this problem as follows: Open all files. Take out the first number of each file. Put them in a container (eg, a vector). Find the smallest number within the container. Put the minimal number in the output file. In his place, put the following number from the file, from which was taken the minimal number. It seems that this method is called "external merge sort".
Tell me, please, is there a smarter way to solve this problem?