Quote:
I want to split a linked list into 4 parts, so that I don't want to allocate new memory.
This requirement was previously missing from the description.
The requirement means that the original list must be dissolved and the elements rearranged in 4 new lists.
The prototype should then look like this:
void splitlist(Adatok** original, Adatok** list1, Adatok** list2, Adatok** list3, Adatok** list4);
As in the previous question, it would make sense to first calculate the minimum number of elements that should be in the new list. Any remainder would be distributed among the first lists until it is completely distributed.
In the previous versions there was a function hozzafuz(), which could now look like this:
void hozzafuz(Adatok** original, Adatok** lista);
The function should then take the first element from the original list each time it is called and append it to the end of lista.
//edit:
To improve the process, it would be better to give the hozzafuz() function the number of elements to be reassigned for the new list as a parameter.
You would then only need to reassign a few pointers.
The prototype would then be:
void hozzafuz(Adatok** original, Adatok** lista, int lsize);