lec0225-generic-ann

# lec0225-generic-ann - Today’s announcements MP3 available...

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

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

View Full Document

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

View Full Document

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

View Full Document

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

View Full Document

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

View Full Document

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.

Unformatted text preview: Today’s announcements: MP3 available, due 2/3, 11:59p. M34 out tonight. Exam 1 returned in section next week. Today: -I7Abstract Data Type — List (conclusion) J—7Generic 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.digltaltutor.net Summary - running times for List fgﬂftions: CW §% Array Insert/Remove at front: 0(1) 0(1) ' . . ﬁe Hare/MW ounhswnl lnserﬂtion: O(B Cm) \ An _» 1k Fagin“ 3.33:4». Remove atagiven location: ab 13inch O(n) shift V. 538 __,Insert at arbitrary location: ) O(n) shift "? k we “a \ [Ha \ocd‘tm Remove at arbitrary location: O(n) find O(n) shift \h. Another list implementation What does the constructor look like? // omzttod_samo ol' sum. 01‘ Priv at: w an «m I u ' 1' Node ‘ prev; :- '-'- cutout; tn: .3;.; Node ' next: // Find and liatuode detn //constructor(a> ) lots of magic: c} ' linclude <liat> - linclude <iostxeam> linclude <string> using namespace std; struct animal ( ‘Itring name: string food; bool big: animal [string n-"blob", string £-"you“, bool b-ttue):name(n).tood|t),bi an int min” I animal g("giratte', "1eaves") . p "penguin", "tun", (also) . b("bear") : 711st<anima1> zoo; — 1O ‘ zoo.push_bacck : oo.puah_back ‘ zoo.puah bac : l/S'l'L list insertAtEnd os\$¢r .4 to:(1ist<an miterato: it - * cout << .name << n u- << return 0: ) Suppose these familiar structures were encapsulated. lterators Ive us the access we need to traverse them anyway! i d Iterators: c—at’jf)fl'ufﬂl 4"" a W- - . E ‘ sci M '5 ~49—°€":0’: "W9 G \$231121: mull? «a ‘ContaiieLﬂa’ssey typically have a variety of iterators deﬁned within: ﬁzzy: 1— unmwi' «rs-'1 n if ﬁnd/rm" {ionu/ (ML. lterators: - EEC]: — m, @ W... class human { public: private: http://www.sgi.comltechlstll Generic programming: (more magic) ‘LJ. 4‘ ‘1': y‘, Generic progtamming: (more magic) on.- panama ( “no: void mum" (Quinn. a) I a (mug) out << a.” << coal: 1: Generic progtamming: (more magic) on.- panama ( “no: void mum" (Quinn. a) I a (mug) out << a.” << coal: I 1: Suppose these familiar structures were encapsulated. lterators give us the access we need to traverse them anyway! And function objects give us the ability to change them systematically. — W ...
View Full Document

{[ snackBarMessage ]}

### Page1 / 13

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

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

View Full Document
Ask a homework question - tutors are online