Suppose there are N nodes in the list, and hence there will be N/k elements in every split part of the list and also the first N%k part will have extra remainder elements and to count the N we can simply use a loop. After this, for every part, you can calculate the number of elements each part will have by using the width of the part.  (N/k + 1) And the left k-(N%k) groups will be of the size N/k .