Data Str & Algorithm HW Solutions 81

Data Str & Algorithm HW Solutions 81 - re-implement...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
81 // Insert element from second matrix this.insert(curr2->value, curr2->row, curr2->col); curr2 = curr2->nextcol; } else { // This element in both matrices this.insert(curr1->value + curr2->value, curr2->row, curr2->col); curr1 = curr1->nextcol; curr2 = curr2->nextcol; } } } 12.12 This is quite simple. The memory pool is simply viewed as a stack. Re- quests pop off the requested amount of storage (move the top pointer down). Returns push the storage back on the stack (move the top pointer up). Just
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: re-implement the stack functions for variable length records. 12.13 Simply manage the memory pool as an array-based queue, with variable length records. Memory requests move the rear pointer by the appropriate amount; memory returns move the front pointer by the appropriate amount. 12.14 (a) 1300, 2000, 1000 (b) 1000, 2000, 1300 (c) 900, 1300, 1100, 1000...
View Full Document

Ask a homework question - tutors are online