4/17/2007
Modern Programming Languages - Chapter 14
// Now p is the index of the block to come
after
// ours in the free list, or NULL, and lag is the
// index of the block to come before ours in the
// free list, or NULL.
// If the one to come after ours is adjacent to it,
// merge it into ours and restore the property
// described above.
if (addr+memory[addr]==p) {
memory[addr] += memory[p]; // add its size to ours
p = memory[p+1]; //
}
A Java
Solution