a class called MemLinkedList. MemLinkedList will use nodes that store a flag (F or A) to represent a Free or

a class called MemLinkedList. MemLinkedList will use nodes that store a flag (F or A) to represent a Free or

Question:

a class called MemLinkedList.  MemLinkedList will use nodes  that store a flag (F or A) to represent a Free or Allocated block of memory, along with the size of the block of memory. It should have the methods listed below.  The methods should all operate on the object making the call (none are static).   Perform checking of the parameters and throw exceptions where appropriate.  The linked list should be as shown in the illustration.  It should not use sentinel nodes (empty header and tail nodes).  You should strive for an efficient implementation of each method.MAKE SURE YOU GOT THIS CONCEPT:
1 megabyte of free memory :
Head–>|F|1000K|–>tail
Requesting 100K of memory…
Head–>|A|100K|–>|F|900K|–>tail
Requesting 200K of memory…
Head–>|A|100K|–>|A|200K|–>|F|700K|–>tail
Releasing 100K of memory…
Head–>|F|300K|–>|F|700K|–>tail
Releasing 200K of memory…
Head–>|F|1000K|–>tail
Clearing the memory…
Head–>|F|1000K|–>tail
  20 points each (a-e)  a.  request(int size)
       allocates a block of this size, receives a size in kilobytes  b.  release(int size)
       frees a block of this size (and repeatedly merges with free neighbors), receives a size in kilobytes  c.  clear()
       resets to the initial 1M free list  d.  print()
       prints each node’s status (A or F) and size  e.  main()
       demonstrates each of your methods

Expert Answer:

Answer rating: 100% (QA)

Here s the required program in JAVA PROGRAM class MemBlock char flag A for Allocated F for Free int sizeKB Size in kilobytes MemBlock next public MemB
View the full answer