CS216: Program and Data Representation University of Virginia Computer Science Spring 2006 David Evans Lecture 1: Introduction.

Slides:



Advertisements
Similar presentations
Intro to CIT 594
Advertisements

CS112: Course Overview George Mason University. Today’s topics Go over the syllabus Go over resources – Marmoset – Blackboard – Piazza – Textbook Highlight.
David Evans CS150: Computer Science University of Virginia Computer Science Lecture 18: The Story So Far.
CS216: Program and Data Representation University of Virginia Computer Science Spring 2006 David Evans Lecture 7: Greedy Algorithms
5/19/2015CS 2011 CS 201 – Data Structures and Discrete Mathematics I Syllabus Spring 2014.
Introduction to Computer Programming I CSE 113
Economics 1 Principles of Microeconomics Instructor: Ted Bergstrom.
Welcome to CSE105 and Happy and fruitful New Year
June 13, Introduction to CS II Data Structures Hongwei Xi Comp. Sci. Dept. Boston University.
Lecturer: Fintan Costello Welcome to Hdip 001 Introduction to Programming.
CSE 830: Design and Theory of Algorithms
January 12, Compiler Design Hongwei Xi Comp. Sci. Dept. Boston University.
Abstract Data Types (ADT)
Administrivia- Introduction CSE 373 Data Structures.
COMP 110 Introduction to Programming Mr. Joshua Stough August 22, 2007 Monday/Wednesday/Friday 3:00-4:15 Gardner Hall 307.
David Evans cs302: Theory of Computation University of Virginia Computer Science Lecture 2: Modeling Computers.
Recursion Chapter 7. Chapter 7: Recursion2 Chapter Objectives To understand how to think recursively To learn how to trace a recursive method To learn.
COMP 14 – 02: Introduction to Programming Andrew Leaver-Fay August 31, 2005 Monday/Wednesday 3-4:15 pm Peabody 217 Friday 3-3:50pm Peabody 217.
July 16, Introduction to CS II Data Structures Hongwei Xi Comp. Sci. Dept. Boston University.
Coursenotes CS3114: Data Structures and Algorithms Clifford A. Shaffer Yang Cao Department of Computer Science Virginia Tech Copyright ©
HORSEED International University
analysis, plug ‘n’ chug, & induction
Quiz 2 Results: Grade Scale
Computer Science 102 Data Structures and Algorithms V Fall 2009 Lecture 1: administrative details Professor: Evan Korth New York University 1.
CS211: Course Overview George Mason University. Today’s topics Go over the syllabus Go over resources – Marmoset – Piazza – Textbook Highlight important.
Cs1120 Fall 2009 David Evans Lecture 19: Stateful Evaluation.
Please CLOSE YOUR LAPTOPS, and turn off and put away your cell phones, and get out your note-taking materials. Today’s daily quiz will be given at the.
WEEK 1 CS 361: ADVANCED DATA STRUCTURES AND ALGORITHMS Dong Si Dept. of Computer Science 1.
Introduction to CS Theory Lecture 1 – Introduction Piotr Faliszewski
Teaching Teaching Discrete Mathematics and Algorithms & Data Structures Online G.MirkowskaPJIIT.
Abstraction IS 101Y/CMSC 101 Computational Thinking and Design Tuesday, September 17, 2013 Carolyn Seaman University of Maryland, Baltimore County.
CS223 Algorithms D-Term 2013 Instructor: Mohamed Eltabakh WPI, CS Introduction Slide 1.
EECS 203: It’s the end of the class and I feel fine. Graphs.
CS216: Program and Data Representation University of Virginia Computer Science Spring 2006 David Evans Lecture 25 There.
CS 103 Discrete Structures Lecture 01 Introduction to the Course
CS216: Program and Data Representation University of Virginia Computer Science Spring 2006 David Evans Lecture 2: Orders of Growth
Recursion Chapter 7. Chapter Objectives  To understand how to think recursively  To learn how to trace a recursive method  To learn how to write recursive.
Abstraction IS 101Y/CMSC 101 Computational Thinking and Design Tuesday, September 17, 2013 Marie desJardins University of Maryland, Baltimore County.
CS 140 Computer Programming (I) Second semester (3 credits) Imam Mohammad bin Saud Islamic University College of Computer Science and Information.
Welcome to CS 115! Introduction to Programming. Class URL Write this down!
CS216: Program and Data Representation University of Virginia Computer Science Spring 2006 David Evans Lecture 4: Dynamic Programming, Trees
Computer Science 102 Data Structures and Algorithms CSCI-UA.0102 Fall 2012 Lecture 1: administrative details Professor: Evan Korth New York University.
CSCI 2670 Introduction to Theory of Computing Instructor: Shelby Funk.
COP3502: Introduction to Computer Science Yashas Shankar.
C++ Programming Language Lecture 2 Problem Analysis and Solution Representation By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department.
CPSC 121: Models of Computation Unit 0 Introduction George Tsiknis Based on slides by Patrice Belleville and Steve Wolfman.
Principles of Computer Science I Honors Section Note Set 1 CSE 1341 – H 1.
1 Daily Announcements CS 202, Spring 2007 Aaron Bloomfield.
CS216: Program and Data Representation University of Virginia Computer Science Spring 2006 David Evans Lecture 3: Levels of Abstraction
Data Structures and Algorithm Analysis Introduction Lecturer: Ligang Dong, egan Tel: , Office: SIEE Building.
1 CS 101 Today’s class will begin about 5 minutes late We will discuss the lab scheduling problems once class starts.
CS 206 Introduction to Computer Science II 01 / 30 / 2009 Instructor: Michael Eckmann.
The Hashemite University Computer Engineering Department
CS216: Program and Data Representation University of Virginia Computer Science Spring 2006 David Evans Lecture 6: Ordered Data Abstractions
Winter 2016CISC101 - Prof. McLeod1 CISC101 Elements of Computing Science I Course Web Site: The lecture outlines.
CS112: Course Overview George Mason University. Today’s topics Go over the syllabus Go over resources – Marmoset – Blackboard – Piazza – Textbook Highlight.
Data Structures and Algorithms in Java AlaaEddin 2012.
CS216: Program and Data Representation University of Virginia Computer Science Spring 2006 David Evans Lecture 8: Crash Course in Computational Complexity.
GEK Frederick H. Willeboordse Compound & Prosper! GEK2507.
DATA STRUCTURES (CS212D) Overview & Review Instructor Information 2  Instructor Information:  Dr. Radwa El Shawi  Room: 
Lecture 3: Rules of Evaluation CS150: Computer Science
Analysis of Algorithms: Math Review Richard Kelley, Lecture 2.
Teachers: If you hand back Test 4 today, tell your class you will review it with them in class on Thursday when you do the review lecture on Chapters 6,
PROBLEM SOLVING AND PROGRAMMING ISMAIL ABUMUHFOUZ | CS 170.
COMP 283 Discrete Structures
Introduction CSE 373 Data Structures.
Administrivia- Introduction
Administrivia- Introduction
Lecture 3: Rules of Evaluation CS200: Computer Science
Presentation transcript:

CS216: Program and Data Representation University of Virginia Computer Science Spring 2006 David Evans Lecture 1: Introduction

2 UVa CS216 Spring Lecture 1: Analyzing Algorithms Menu Motivating Problem Course Structure, Expectations, Goals Analyzing Algorithms

3 UVa CS216 Spring Lecture 1: Analyzing Algorithms Phylogeny from

4 UVa CS216 Spring Lecture 1: Analyzing Algorithms Language Phylogeny tree house baum haus treow hus tre hus strom domovni arbol casa albero casa arbore casa arbre maison Latin: arbor domus casa

5 UVa CS216 Spring Lecture 1: Analyzing Algorithms Language Phylogeny English German Anglo-Saxon Norwegian Czech Spanish Italian Romanian French

6 UVa CS216 Spring Lecture 1: Analyzing Algorithms Tree of Life From

7 UVa CS216 Spring Lecture 1: Analyzing Algorithms Finding a Phylogeny Speculate on history based on current evidence –Not guaranteed to be correct Find the “most likely” history –Parsimony: find the evolutionary tree that explains the observations with the fewest possible changes

8 UVa CS216 Spring Lecture 1: Analyzing Algorithms Measuring Changes Natural Languages –Grammatical Rules –Lexicon –Hard to quantify how similar two languages are Species –Genomes (only recently) –Easy to quantify: genome differences are measurable

9 UVa CS216 Spring Lecture 1: Analyzing Algorithms How Species Evolve Point Mutations (Substitution): one base is replaced with another …CAT… …CTT… UV Ray With only point mutations, easy to tell how close two genomes are, just count the different bases

10 UVa CS216 Spring Lecture 1: Analyzing Algorithms How Species Evolve 2 Insertions: one or more bases are inserted Deletions: one or more bases are removed …GCATG… …GCACATG… …GCATCATG… …GCATG… Caused by copying errors (enzymes slipping, etc.)

11 UVa CS216 Spring Lecture 1: Analyzing Algorithms Measuring Genome Similarity Insertions and Deletions this hard ACATCATCATCAT CATCATCATCATC are more “similar” than ACATCATCATCAT | | | | TCGTTCGCGAAAA

12 UVa CS216 Spring Lecture 1: Analyzing Algorithms Sequence Alignment Align sequences by inserting gaps: Find best alignment inserting gaps given: –value of matching bases (point mutations) = c –cost of a gap (insertion/deletion) = g ACATCATCATCAT |||||||||||| -CATCATCATCAT We use c = 10, g = 2 : goodness = 12 * c – g = 118

13 UVa CS216 Spring Lecture 1: Analyzing Algorithms Brute Force Alignment To find the best alignment of sequences U and V with correct value c and gap penalty g: if U or V is empty U, V is the best alignment otherwise, [ next slide ]

14 UVa CS216 Spring Lecture 1: Analyzing Algorithms Brute Force Alignment: Otherwise… Try three possibilities: 1. First elements of U and V are aligned: score of best alignments of U[1:] and V[1:] + c if U[0] == V[0] 2. First element of U is aligned with a gap in V score of best alignments of U[1:] and V + g 3. First element of V is aligned with a gap in U score of best alignments of U and V[1:] + g Pick the choice with the highest score U[1:] means U with the first element removed

15 UVa CS216 Spring Lecture 1: Analyzing Algorithms Is this a “good” solution?

16 UVa CS216 Spring Lecture 1: Analyzing Algorithms Course Structure, Expectations, Goals

17 UVa CS216 Spring Lecture 1: Analyzing Algorithms Staff Me: David Evans (Call me “Dave” or “Coach”) –Office Hours posted on course website –Always available by , if I don’t reply in 24 hours, send again and complain Assistant Coaches: Erika Chin, David Faulkner, Erin Golub, Sam Guarnieri, Katherine Jogerst, and Pitchaya (“Yam”) Sitthi-Amorn –Will lead Monday and Tuesday sections –Available in Small Hall lab at posted times (only)

18 UVa CS216 Spring Lecture 1: Analyzing Algorithms Meetings Lectures: 2 per week –Will include material not in the book –Most lectures will use slides and notes Section meetings: 1 per week –You must sign up for one of the sections –Classroom work, group exercises, review, quizzes, … Staffed time in Small Hall –Take advantage of help from the ACs and your classmates

19 UVa CS216 Spring Lecture 1: Analyzing Algorithms Problem Sets 8 total, 1-2½ weeks each Work on them when and where you want (but take advantage of staffed lab time in Small Hall) Usually will work with partners Mix of programming and analysis Main way most will learn Turn in on paper at beginning of class (first is due Wednesday)

20 UVa CS216 Spring Lecture 1: Analyzing Algorithms My Teaching Philosophy: Drinking from a Firehose It may hurt a little bit, and a lot of water will go by you, but you won’t go away thirsty! Don’t be overwhelmed! You will do fine.

21 UVa CS216 Spring Lecture 1: Analyzing Algorithms Expectations: Programming Background You understand basic programming: –Can write a program longer than a screenful –Can understand multi-file programs –Familiar with common control structures, procedures, recursive definitions You don’t freak out when you are expected to learn a new language on your own

22 UVa CS216 Spring Lecture 1: Analyzing Algorithms Expectations: Math and Logic Background You remember some things from CS202 (or will learn/re-learn them when you need them): –Arithmetic, logarithms, sets, graphs –Symbolic logic, implication –Proof techniques (induction, contradiction) The textbook is quite mathematical – you may need to read things more than once

23 UVa CS216 Spring Lecture 1: Analyzing Algorithms Expectations: Honor Everyone will be expected to follow what is on the course pledge Exact content will be determined before next class based on your survey responses –I hope to place a large burden on the honor system, but won’t if students think this puts honest students at a disadvantage

24 UVa CS216 Spring Lecture 1: Analyzing Algorithms Course Goals

25 UVa CS216 Spring Lecture 1: Analyzing Algorithms Course Goal 1 Learn to write delightful programs. correct, readable, elegant, economical, efficient, scalable, maintainable, secure, dependable

26 UVa CS216 Spring Lecture 1: Analyzing Algorithms Course Goal 2 Be able to predict how decisions about data representation will impact properties of an implementation. running time, memory use, ease of implementation, scalability, …

27 UVa CS216 Spring Lecture 1: Analyzing Algorithms Course Goal 3 Understand how a program executes at levels of abstraction ranging from a high-level programming language to machine memory. We will talk about what this means in Monday’s class.

28 UVa CS216 Spring Lecture 1: Analyzing Algorithms if U or V is empty U, V is the best alignment otherwise, Try three possibilities: 1. First elements of U and V are aligned: score of best alignments of U[1:] and V[1:] + c if U[0] == V[0] 2. First element of U is aligned with a gap in V score of best alignments of U[1:] and V + g 3. First element of V is aligned with a gap in U score of best alignments of U and V[1:] + g Pick the choice with the highest score Is this a “good” solution?

29 UVa CS216 Spring Lecture 1: Analyzing Algorithms Algorithm Properties Implementable – can be readily expressed as a program Termination – always finishes Correctness – always gives the correct answer Efficient – uses resources wisely Note: Chapter 2 of text has a similar list but separates “Implementable” into Effectiveness and Program Complexity

30 UVa CS216 Spring Lecture 1: Analyzing Algorithms Is it Implementable? def bestAlignment (U, V, c, g): if len(U) == 0 or len(V) == 0: return U, V else: (U0, V0) = bestAlignment (U[1:], V[1:], c, g) scoreNoGap = goodnessScore (U0, V0, c, g) if U[0] == V[0]: scoreNoGap += c # try inserting a gap in U (no match for V[0]) (U1, V1) = bestAlignment (U, V[1:], c, g) scoreGapU = goodnessScore (U1, V1, c, g) - g # try inserting a gap in V (no match for U[0]) (U2, V2) = bestAlignment (U[1:], V, c, g) scoreGapV = goodnessScore (U2, V2, c, g) - g …

31 UVa CS216 Spring Lecture 1: Analyzing Algorithms Is it Implementable? def bestAlignment (U, V, c, g): if len(U) == 0 or len(V) == 0: return U, V else: (U0, V0) = bestAlignment (U[1:], V[1:], c, g) scoreNoGap = goodnessScore (U0, V0, c, g) if U[0] == V[0]: scoreNoGap += c # try inserting a gap in U (no match for V[0]) (U1, V1) = bestAlignment (U, V[1:], c, g) scoreGapU = goodnessScore (U1, V1, c, g) - g # try inserting a gap in V (no match for U[0]) (U2, V2) = bestAlignment (U[1:], V, c, g) scoreGapV = goodnessScore (U2, V2, c, g) - g if scoreNoGap >= scoreGapU and scoreNoGap >= scoreGapV: return U[0] + U0, V[0] + V0 elif scoreGapU >= scoreGapV: return GAP + U1, V[0] + V1 else: return U[0] + U2, GAP + V2

32 UVa CS216 Spring Lecture 1: Analyzing Algorithms Algorithm Properties Implementable – can be readily expressed as a program Termination – always finishes Correctness – always gives the correct answer Efficient – uses resources wisely

33 UVa CS216 Spring Lecture 1: Analyzing Algorithms Termination? if U or V is empty U, V is the best alignment otherwise, Try three possibilities: 1. First elements of U and V are aligned: score of best alignments of U[1:] and V[1:] + c if U[0] == V[0] 2. First element of U is aligned with a gap in V score of best alignments of U[1:] and V + g 3. First element of V is aligned with a gap in U score of best alignments of U and V[1:] + g Pick the choice with the highest score

34 UVa CS216 Spring Lecture 1: Analyzing Algorithms if U or V is empty U, V is the best alignment otherwise, Try three possibilities: 1. First elements of U and V are aligned: score of best alignments of U[1:] and V[1:] + c if U[0] == V[0] 2. First element of U is aligned with a gap in V score of best alignments of U[1:] and V + g 3. First element of V is aligned with a gap in U score of best alignments of U and V[1:] + g Pick the choice with the highest score Every attempt, at least one element is removed (and none added). Initial length is finite, so must terminate.

35 UVa CS216 Spring Lecture 1: Analyzing Algorithms Algorithm Properties Implementable – can be readily expressed as a program Termination – always finishes Correctness – always gives the correct answer –Very informally: it tries all possibilities and picks the best one Efficient – uses resources wisely

36 UVa CS216 Spring Lecture 1: Analyzing Algorithms Efficiency? What resources do we care about? –Programmer Time –Running Time –Space Use

37 UVa CS216 Spring Lecture 1: Analyzing Algorithms Measuring Resource Use Space –Fundamental unit: bit Running Time –No fundamental unit Number of steps? How much can you do in one step? How long does a step take? How does it scale with the size of the input Answering for this algorithm is a PS1 question

38 UVa CS216 Spring Lecture 1: Analyzing Algorithms Charge Registration Survey –Linked from course web site –Submit by Friday 5pm Text: Read chapters 1-3 PS1: Out now, due in 1 week –Start now – the section time is not for doing PSs Monday: Levels of Abstraction, Order Notation