تم الحل ✓
categoryبرمجة وتطوير البرمجيات
schoolبكالوريوس
event_available2026-07-15
السؤال
Transcribed Image Text:
3. Heap management is much more robust if heap allocation is done by best-fit, rather
than first fit. Write the following class to implement a best-fit heap allocator.
BestFitHeapAllocator
+ Best FitHeapAllocator(size: int)
+newH(size int): int
+deleteH(block: int): void
Test your class with the following main program:
// a test program
public static void main(String[] args) {
Best FitHeapAllocator bha =new Best FitHeapAllocator (12);
int xbha.newH (2);
int y bha.newH (3);
bha.deleteH (y);
int z bha.newH (2);
System.out.println(y);
System.out.println(z);
} // end of test program
Turn in a listing of your program, and the results of the test run.
(Note: A good place to start is by examining the class HeapAllocator from Handout #7 to
see how it can be modified. You can download a copy from my website.)
check_circle الجواب — حل مفصل خطوة بخطوة
hourglass_top
🔒
الحل الكامل متاح للمشتركين
اشترك في أرشيف الأسئلة لعرض هذا الحل وآلاف الحلول المفصلة خطوة بخطوة من معلمين معتمدين.