Lecture 11

Listclasslistclass while head null cur head

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

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

Unformatted text preview: the list. listClass::~listClass( ) { while (head != NULL) { cur = head next; delete head; head = cur; } } 10 Finding where to insert in a (sorted!) array can be done with Binary Search. That’ s fast. (And fast is good.) Finding where to insert in a (sorted!) linked list requires sequential search. That’ slow. s (And slow is bad.) 11 12 In summary, we found: Once you found where to insert/delete, in an array you need to make space for a new item. Especially at the beginning of an array that is slow! (And slow is bad). Find Place Array Linked List Once you found where to insert/delete in a linked list, you ju...
View Full Document

Ask a homework question - tutors are online