hi all, i've run into few problems while working tacop 2.2.2 sequential allocations, repacking memory section at page 247.
the subject is there are n stacks sharing a common area locations L0 < L < LX, initially we set BASE[j] = TOP[j] = L0 for 1 <= j <= n
the goal is when overflow occurs while inserting or deleting elements with respect to stack i, how to repack memory. (making room for stack i by taking some away from tables that aren't yet filled).
a). find the smallest k for which i < k < n and TOP[k] < BASE[k+1], if any such k exists. move things up one notch, Set CONTENTS(L+1) -> CONTENTS(L), for TOP[k] >= L > BASE[i+1] finally, Set BASE[j] -> BASE[j] + 1, TOP[j] -> TOP[j] + 1, for i < j < k
here's my questions:
how do they find the stack that aren't yet to be filled? stack k? and why chose the smallest k?