lec0225-generic - Today’s announcements MP3 available due...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon

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

View Full Document Right Arrow Icon

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

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: Today’s announcements: MP3 available, due 2/25, 11:59p. MP4 out tonight. Exam 1 returned in section next week. Today: Abstract Data Type – List (conclusion) Generic programming Aside: Many many different variations on linked lists: In lab and MP3 you used a doubly linked list Circularly linked list Ladder list Any kind of crazy linked structure you can imagine. To practice your skills: www.digitaltutor.net Summary – running times for List functions: SLL Array Insert/Remove at front: O(1) O(1) Insert at given location: O(1) O(1) Remove at given location: O(1) hack O(n) shift Insert at arbitrary location: O(1) O(n) shift Remove at arbitrary location: O(n) find O(n) shift Another list implementation What does the constructor look like? head tail template<class LIT> class List { public: // omitted…same ol’ same ol’ private: listNode * head; listNode * tail; listNode * current; int size; // Find and listNode defn }; struct listNode { LIT element; Node * prev; Node * next; //constructor(s) } lots of magic: #include <list> #include <iostream> #include <string> using namespace std; struct animal { string name; string food; bool big;...
View Full Document

{[ snackBarMessage ]}

Page1 / 12

lec0225-generic - Today’s announcements MP3 available due...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online