110 likes | 214 Views
CSE111: Great Ideas in Computer Science. Dr. Carl Alphonce 219 Bell Hall Office hours: M-F 11:00-11:50 645-4739 alphonce@buffalo.edu. cell phones off (please). Announcements. Exam 1 & 2 handback HW4 due April 2 Third is exam is April 21 (last full week of classes)
E N D
CSE111: Great Ideas in Computer Science Dr. Carl Alphonce 219 Bell Hall Office hours: M-F 11:00-11:50 645-4739 alphonce@buffalo.edu
cell phones off (please)
Announcements • Exam 1 & 2 handback • HW4 due April 2 • Third is exam is April 21 (last full week of classes) • We will be taking attendance • Does not count directly for grade • Just curious who is and is not attending
Today’s Agenda • Algorithm wrap-up • Computer graphics introduction
Describing algorithms • Flow-of-control structures • Sequencing • Selection • Repetition • Primitive operations • E.g. pairwisecomparision
Developing algorithms • Top-down • Start with abstract/general case • Iteratively make more specific • Bottom-up • Start with concrete case • Iteratively make more general
Sorting • Put items in order • “smallest” to “largest” • “largest” to “smallest” • Ordering can be done in many ways • Name • SSN • GPA, then age, then telephone number
Selection sort • Choose smallest • Place at front • Repeat with rest until done • To sort n numbers, needs O(n2) time
Merge sort • Split into (roughly) equal halves • Recursively sort the halves • Merge results to produce answer • To sort n numbers, needs O(n log2n) time
Computer Graphics • Tron (1982) • Shrek (2001, 2004, 2007) • LOTR (2001,2002,2003) • Harry Potter (2001-2009, current) • Pirates of the Carribean (2003, 2006, 2007) • Avatar (2009)