Data Structures &amp; Alogs HW_Part_7

# Data Structures &amp; Alogs HW_Part_7 - 25 Move curr to...

This preview shows pages 1–2. Sign up to view the full content.

25 // Move curr to prev position template <class Elem> void LList<Elem>::prev() { link* temp = curr; while (temp->next!=curr) temp=temp->next; curr = temp; } (b) The answer is rather similar to that of Part (a). 4.7 The space required by the array-based list implementation is f xed. It must be at least n spaces to hold n elements, for a lower bound of Ω( n ) .However ,the actual number of elements in the array ( n ) can be arbitrarily small compared to the size of the list array. 4.8 D is number of elements; E is in bytes; P is in bytes; and n is number of elements. Setting number of elements as e and number of bytes as b ,the equation has form e > eb/ ( b + b )= eb/b = e for a comparison of e>e which is correct. 4.9 (a) Since E =8 , P =4 ,and D =20 , the break-even point occurs when n = (20)(8) / (4+8)=13 1 3 . So, the linked list is more ef f cient when 13 or fewer elements are stored. (b) Since E =2 , P =4 ,and D =30 , the break-even point occurs when n = (30)(2) / (2+4)=10 . So, the linked list is more ef f cient when less than 10 elements are stored. (c) Since E =1 , P =4 ,and D =30 , the break-even point occurs when n = (30)(1) / (1+4)=6 .

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This document was uploaded on 10/31/2011 for the course BCN 3431 at University of Florida.

### Page1 / 4

Data Structures &amp; Alogs HW_Part_7 - 25 Move curr to...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online