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

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

View Full Document Right Arrow Icon
Background image of page 1

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

View Full DocumentRight Arrow Icon
Background image of page 2
Background image of page 3

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

View Full DocumentRight Arrow Icon
Background image of page 4
Background image of page 5

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

View Full DocumentRight Arrow Icon
Background image of page 6
Background image of page 7

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

View Full DocumentRight Arrow Icon
Background image of page 8
Background image of page 9

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

View Full DocumentRight Arrow Icon
Background image of page 10
Background image of page 11

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

View Full DocumentRight Arrow Icon
Background image of page 12
Background image of page 13
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 fgflftions: CW §% Array Insert/Remove at front: 0(1) 0(1) ' . . fie Hare/MW ounhswnl lnserfltion: 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'uffll 4"" a W- - . E ‘ sci M '5 ~49—°€":0’: "W9 G $231121: mull? «a ‘ContaiieLfla’ssey typically have a variety of iterators defined within: fizzy: 1— unmwi' «rs-'1 n if find/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

Page1 / 13

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

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

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