I have a question from my assignment which I don't entirely understand. Can anyone please look at it and see if it's as easy as I thought it was or if I'm wrong, in which case can anyone help? This is the question; the answers follow:
Assume that an integer requires 2 bytes of space and a reference requires 4 bytes of space. Also assume the maximum queue size is 200. We define "overhead" space as the space required by the structure that does not include the space used by the elements the structure contains.
a) How much overhead space is needed for:
i. A bounded array-based queue holding 20 elements? 40
ii. A bounded array-based queue holding 100 elements? 200
iii. A bounded array-based queue holding 200 elements? 400
iv. A reference-based queue holding 20 elements? 80
v. A reference-based queue holding 100 elements? 400
vi. A reference-based queue holding 200 elements? 800
b) For what size queue do the array-based and reference-based approaches use approximately the same amount of overhead space?