Question: Code Overview You're going to write just one class for this project, although you may add additional classes if you want. That class is called

 Code Overview You're going to write just one class for thisproject, although you may add additional classes if you want. That class

Code Overview You're going to write just one class for this project, although you may add additional classes if you want. That class is called MemMan which represents the memory management part of the computer. To do this you are going to use two additional classes which are already written: 1. MemBlock represents a block of memory in the computer. It is basically a tuple: (address, size, is Free). 2. BareNode represents the node of a linked list of MemBlocks. You may add any public, private, or protected methods you want to these classes, but the provided/required classes, methods, and variables must still work and remain unmodified. You cannot change provided code in any way. 5. boolean free (BareNode node) Given a node, free it. Coalesce if necessary. Return true if free was possible, return false otherwise. You cannot free something that is already free. You cannot free something when the pointer (bare node) is null. Required Big-O: 0(1). 6. BareNode realloc (BareNode node, int size) Given a node and a size, reallocate the memory. Return the new block (or the resized block) if you were able to reallocate, otherwise return null. You cannot reallocate with invalid sizes, invalid pointers, or when you don't have enough memory. Required Big-O: O(1) when shrinking or expanding, otherwise O(n) when where n = the number of blocks (not bytes) in memory. Code Overview You're going to write just one class for this project, although you may add additional classes if you want. That class is called MemMan which represents the memory management part of the computer. To do this you are going to use two additional classes which are already written: 1. MemBlock represents a block of memory in the computer. It is basically a tuple: (address, size, is Free). 2. BareNode represents the node of a linked list of MemBlocks. You may add any public, private, or protected methods you want to these classes, but the provided/required classes, methods, and variables must still work and remain unmodified. You cannot change provided code in any way. 5. boolean free (BareNode node) Given a node, free it. Coalesce if necessary. Return true if free was possible, return false otherwise. You cannot free something that is already free. You cannot free something when the pointer (bare node) is null. Required Big-O: 0(1). 6. BareNode realloc (BareNode node, int size) Given a node and a size, reallocate the memory. Return the new block (or the resized block) if you were able to reallocate, otherwise return null. You cannot reallocate with invalid sizes, invalid pointers, or when you don't have enough memory. Required Big-O: O(1) when shrinking or expanding, otherwise O(n) when where n = the number of blocks (not bytes) in memory

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!