Hello. My problem is that I have to implement a sorting algorithm by merging with text files, in the input file (to be sorted) each number is on a separate line.
The solution should have a constant memory complexity (download only a small number of values from files.
How to write a recursive function, which downloads only a small number of values from the file and divides them and merges it
1 2 3 4 5 6 7 8 9 10 11 12
oid sortowanie(fstream &plik, int start, int endkoniec)
{
int srodek;
if(start!=end)
{
mid = koniec / 2;
sortowanie(plik, start, srodek);
sortowanie(plik, mid + 1, end);
scalanie(plik, start, mid, ecd);
}
}