Course Announcements. John Jannotti (cs32) Scope, Collections & Generics Feb 8, / 1

Size: px
Start display at page:

Download "Course Announcements. John Jannotti (cs32) Scope, Collections & Generics Feb 8, / 1"

Transcription

1 Course Announcements Stars is due tomorrow. Stars grades should be out by next Monday. Javascript lab out today. How you make interactive webby GUIs. Today we re going to cover a bit of a hodge podge. John Jannotti (cs32) Scope, Collections & Generics Feb 8, / 1

2 Scope, Collections & Generics John Jannotti /course/cs0320/www/lectures/ Feb 8, 2018 John Jannotti (cs32) Scope, Collections & Generics Feb 8, / 1

3 A little food for thought on Stars Should my program do this obviously correct thing? Yes. What do you do if two stars have the same coordinate? What do you do if two stars have the same name? Do you report more that one error in a CSV? Do you report where an error in CSV occurred? Can you easily you add new commands? Is your command processing reusable? How did you write tests for your command processing? Can you add() to your KdTree? remove()? John Jannotti (cs32) Scope, Collections & Generics Feb 8, / 1

4 Dynamic / Static Dispatch 1 c l a s s Person { 2 S t r i n g c o n f e s s ( Object msg ) { r e t u r n msg. t o S t r i n g ( ) ; 3 } 4 c l a s s Spy e x t e n d s Person { 5 S t r i n g c o n f e s s ( S t r i n g msg ) { r e t u r n Never! ; } 6 } 7 Person p = new Person ( ) ; 8 p. c o n f e s s ( The dock, at 11am ) ; 9 Spy s1 = new Spy ( ) ; 0 s1. c o n f e s s ( The a i r p o r t, at 12pm ) ; 1 Person p2 = s1 ; 2 p2. c o n f e s s ( The depot, at 6pm ) ; 3 Spy s3 = new Spy ( ) ; 4 s3. c o n f e s s ( new S t r i n g B u i l d e r ( The stadium, at 3pm ) ) ; John Jannotti (cs32) Scope, Collections & Generics Feb 8, / 1

5 equals / hashcode 1 c l a s s L a b e l { 2 p r i v a t e f i n a l S t r i n g t e x t ; 3 p u b l i c L a b e l ( S t r i n g t ) { t e x t = t ; } 4 } 5 Set<Label > seen = new HashSet <>(); 6 seen. add ( new L a b e l ( John ) ) ; 7 seen. c o n t a i n s ( new L a b e l ( John ) ) ; John Jannotti (cs32) Scope, Collections & Generics Feb 8, / 1

6 equals / hashcode 1 c l a s s L a b e l { 2 p r i v a t e f i n a l S t r i n g t e x t ; 3 p u b l i c L a b e l ( S t r i n g t ) { t e x t = t ; } 4 p u b l i c boolean e q u a l s ( Object o ) { 5 / assume c o r r e c t, b a s i c a l l y comparing t e x t / 6 } 7 } 8 Set<Label > seen = new HashSet <>(); 9 seen. add ( new L a b e l ( John ) ) ; 0 seen. c o n t a i n s ( new L a b e l ( John ) ) ; John Jannotti (cs32) Scope, Collections & Generics Feb 8, / 1

7 Snapshot Diagrams A standard way to draw the execution state of a program. Primitives are draw bare. Objects are shown as circles, labeled by type. Details as needed. John Jannotti (cs32) Scope, Collections & Generics Feb 8, / 1

8 Mutability Modifying an object is changing what s in the circle. We show immutable objects with a double border. Changing them is really reassignment. We use a double arrow to show a reference that can t be changed. ( final ). John Jannotti (cs32) Scope, Collections & Generics Feb 8, / 1

9 Local and Global Variables 1 c l a s s Payment { 2 p u b l i c d o u b l e v a l u e ; 3 p u b l i c s t a t i c d o u b l e taxrate = ; 4 p u b l i c s t a t i c v o i d main ( S t r i n g [ ] a r g s ) { 5 Payment p = new Payment ( ) ; 6 p. v a l u e = ; 7 taxrate = ; 8 System. out. p r i n t l n ( p. v a l u e (1 + taxrate ) ) ; 9 } 0 } John Jannotti (cs32) Scope, Collections & Generics Feb 8, / 1

10 Now we can talk about scopes The basics: static methods can see their own local variables, and static fields of their class. instance methods can see their locals, the static fields and the instance fields (through this). In both, variables of inner blocks can t be seen outside. Strive to minimize scope. John Jannotti (cs32) Scope, Collections & Generics Feb 8, / 1

11 Now we can talk about scopes The basics: static methods can see their own local variables, and static fields of their class. instance methods can see their locals, the static fields and the instance fields (through this). In both, variables of inner blocks can t be seen outside. Strive to minimize scope. Now the tricky stuff. Inner class, both static and normal. John Jannotti (cs32) Scope, Collections & Generics Feb 8, / 1

12 Generics Many abstractions are generic across types. Holders: Optional, ThreadLocal Factory methods: ImmutableList.of(), DB.getObject(Company.class, id) Collections: List<String>, Map<Label, Person> Before Generics, these abstractions took/returned Object. Return values were cast to the (statically known) return type. The compiler couldn t help with mistakes, refactoring. ClassCastException was a common error. John Jannotti (cs32) Scope, Collections & Generics Feb 8, / 1

13 Generic comparison 1 / words must c o n t a i n o n l y S t r i n g 3 / 4 v o i d swear ( C o l l e c t i o n words ) { 5 f o r ( Object o : words ) { 6 S t r i n g word = ( S t r i n g ) o ; 7 i f ( word. l e n g t h ( ) == 4) 8 System. out. p r i n t l n ( word ) ; 9 } 0 } 1 2 v o i d swear ( C o l l e c t i o n <S t r i n g > words ) { 3 f o r ( S t r i n g word : words ) 4 i f ( word. l e n g t h ( ) == 4) 5 System. out. p r i n t l n ( word ) ; 6 } John Jannotti (cs32) Scope, Collections & Generics Feb 8, / 1

14 Writing generic abstractions You ve probably all used generic abstractions. Have you written any? What? Simple things are pretty simple. Complex things can be very, very complex. John Jannotti (cs32) Scope, Collections & Generics Feb 8, / 1

15 Pair.java 1 p u b l i c c l a s s Pair <A, B> { 2 p r i v a t e f i n a l A l e f t ; 3 p r i v a t e f i n a l B r i g h t ; 4 5 p u b l i c P a i r (A a, B b ) { 6 l e f t = a ; 7 r i g h t = b ; 8 } 9 1 p u b l i c S t r i n g t o S t r i n g ( ) { 2 r e t u r n ( +l e f t+. +r i g h t+ ) ; 3 } 4 } John Jannotti (cs32) Scope, Collections & Generics Feb 8, / 1

16 Type constraints Why isn t this legal? 1 L i s t <Pair <I n t e g e r, S t r i n g >> l s t = 2 I m m u t a b l e L i s t. o f ( new Pair <>(4, john ), 3 new Pair <>(2, mary ), 4 new Pair <>(7, pat ) ) ; 5 C o l l e c t i o n s. s o r t ( a ) ; John Jannotti (cs32) Scope, Collections & Generics Feb 8, / 1

17 Type constraints Why isn t this legal? 1 L i s t <Pair <I n t e g e r, S t r i n g >> l s t = 2 I m m u t a b l e L i s t. o f ( new Pair <>(4, john ), 3 new Pair <>(2, mary ), 4 new Pair <>(7, pat ) ) ; 5 C o l l e c t i o n s. s o r t ( a ) ; Because Pair<Integer,String> does not implement Comparable<Pair<Integer,String>> John Jannotti (cs32) Scope, Collections & Generics Feb 8, / 1

18 Can we implement Comparable? 1 p u b l i c c l a s s Pair <A, B> { 2 p u b l i c i n t compareto ( Pair <A, B> o t h e r ) { 3... a. compareto ( o t h e r. a )... 4 } 5 } John Jannotti (cs32) Scope, Collections & Generics Feb 8, / 1

19 Can we implement Comparable? 1 p u b l i c c l a s s Pair <A, B> { 2 p u b l i c i n t compareto ( Pair <A, B> o t h e r ) { 3... a. compareto ( o t h e r. a )... 4 } 5 } No. The types A & B might not, themselves, be Comparable<A> and Comparable<B> John Jannotti (cs32) Scope, Collections & Generics Feb 8, / 1

20 Manipulating generic objects Suppose your printall() handles any Collection. Iterates over the members and calls tostring() What s the signature of printall()? John Jannotti (cs32) Scope, Collections & Generics Feb 8, / 1

21 Manipulating generic objects Suppose your printall() handles any Collection. Iterates over the members and calls tostring() What s the signature of printall()? void printall(collection c);? void printall(collection<object> c);? John Jannotti (cs32) Scope, Collections & Generics Feb 8, / 1

22 Manipulating generic objects Suppose your printall() handles any Collection. Iterates over the members and calls tostring() What s the signature of printall()? void printall(collection c);? void printall(collection<object> c);? void printall(collection<?> c); John Jannotti (cs32) Scope, Collections & Generics Feb 8, / 1

23 Manipulating generic objects Suppose your printall() handles any Collection. Iterates over the members and calls tostring() What s the signature of printall()? void printall(collection c);? void printall(collection<object> c);? void printall(collection<?> c); What if you want to call draw() on a list of any Shapes? draw(list<shape> shapes);? John Jannotti (cs32) Scope, Collections & Generics Feb 8, / 1

24 Manipulating generic objects Suppose your printall() handles any Collection. Iterates over the members and calls tostring() What s the signature of printall()? void printall(collection c);? void printall(collection<object> c);? void printall(collection<?> c); What if you want to call draw() on a list of any Shapes? draw(list<shape> shapes);? John Jannotti (cs32) Scope, Collections & Generics Feb 8, / 1

25 Manipulating generic objects Suppose your printall() handles any Collection. Iterates over the members and calls tostring() What s the signature of printall()? void printall(collection c);? void printall(collection<object> c);? void printall(collection<?> c); What if you want to call draw() on a list of any Shapes? draw(list<shape> shapes);? Can you pass in a List<Circle>? John Jannotti (cs32) Scope, Collections & Generics Feb 8, / 1

26 Manipulating generic objects Suppose your printall() handles any Collection. Iterates over the members and calls tostring() What s the signature of printall()? void printall(collection c);? void printall(collection<object> c);? void printall(collection<?> c); What if you want to call draw() on a list of any Shapes? draw(list<shape> shapes);? Can you pass in a List<Circle>? draw(list<?>);? John Jannotti (cs32) Scope, Collections & Generics Feb 8, / 1

27 Manipulating generic objects Suppose your printall() handles any Collection. Iterates over the members and calls tostring() What s the signature of printall()? void printall(collection c);? void printall(collection<object> c);? void printall(collection<?> c); What if you want to call draw() on a list of any Shapes? draw(list<shape> shapes);? Can you pass in a List<Circle>? draw(list<?>);? draw(list<? extends Shape>); John Jannotti (cs32) Scope, Collections & Generics Feb 8, / 1

28 Your KDTree You should have a generic KDTree. You ll thank me later. What makes KDTree<T> harder than List<T>? John Jannotti (cs32) Scope, Collections & Generics Feb 8, / 1

29 Your KDTree You should have a generic KDTree. You ll thank me later. What makes KDTree<T> harder than List<T>? KDTrees are not completely generic. Items must have positions. John Jannotti (cs32) Scope, Collections & Generics Feb 8, / 1

30 Your KDTree You should have a generic KDTree. You ll thank me later. What makes KDTree<T> harder than List<T>? KDTrees are not completely generic. Items must have positions. In 3D space? KD? John Jannotti (cs32) Scope, Collections & Generics Feb 8, / 1

31 Your KDTree You should have a generic KDTree. You ll thank me later. What makes KDTree<T> harder than List<T>? KDTrees are not completely generic. Items must have positions. In 3D space? KD? You want a constraint like draw() has. John Jannotti (cs32) Scope, Collections & Generics Feb 8, / 1

32 Your KDTree You should have a generic KDTree. You ll thank me later. What makes KDTree<T> harder than List<T>? KDTrees are not completely generic. Items must have positions. In 3D space? KD? You want a constraint like draw() has. If you have internal classes, they probably need the same constraint. John Jannotti (cs32) Scope, Collections & Generics Feb 8, / 1

33 KDTree as Collection Consider implementing Collection. Someone else has thought about completeness. You will interoperate with more code. But (it seems like) you need to implement 15 methods! John Jannotti (cs32) Scope, Collections & Generics Feb 8, / 1

34 KDTree as Collection Consider implementing Collection. Someone else has thought about completeness. You will interoperate with more code. But (it seems like) you need to implement 15 methods! You can extend AbstractCollection to get a leg up. You ll just need size and iterator. You ought to provide a constructor from Collection. How about add? That iterator is a bit challenging. Allows for (Star s : tree) { } John Jannotti (cs32) Scope, Collections & Generics Feb 8, / 1

35 Enhanced For Loop 1 // Old s t y l e 2 s t a t i c v o i d swear ( C o l l e c t i o n <S t r i n g > c ) { 3 f o r ( I t e r a t o r <S t r i n g > i = c. i t e r a t o r ( ) ; i. hasnext ( ) ; ) 4 S t r i n g word = i. next ( ) ; 5 i f ( word. l e n g t h ( ) == 4) 6 System. out. p r i n t l n ( word ) ; 7 } 8 } 9 0 // New s t y l e 1 s t a t i c v o i d swear ( C o l l e c t i o n <S t r i n g > c ) { 2 f o r ( S t r i n g word : c ) 3 i f ( word. l e n g t h ( ) == 4) 4 System. out. p r i n t l n ( word ) ; 5 } John Jannotti (cs32) Scope, Collections & Generics Feb 8, / 1

36 How does the new for loop work? It s just syntactic sugar Essentially compiles to the Iterator code. What s required? c.iterator() A new interface: Iterable Key point: c is Iterable, not an Iterator. An Iterator abstracts one iteration, Iterable abstracts the ability to be iterated over. When will you still use the iterator code pattern? When you need access to Iterator.remove() John Jannotti (cs32) Scope, Collections & Generics Feb 8, / 1

37 Why should you bother? Java made many things Iterable Arrays Collections or all kinds So why should you bother makeing your types Iterable? You could just return one of the iterable types. And clients would still get to use the nice for-loops. Remember to copy or wrap modifiable objects. John Jannotti (cs32) Scope, Collections & Generics Feb 8, / 1

38 Why should you bother? Java made many things Iterable Arrays Collections or all kinds So why should you bother makeing your types Iterable? You could just return one of the iterable types. And clients would still get to use the nice for-loops. Remember to copy or wrap modifiable objects. But consider allowing iteration over a binary tree. Or your KDTree. Why can t we lean on the existing collections? John Jannotti (cs32) Scope, Collections & Generics Feb 8, / 1

39 Why should you bother? Java made many things Iterable Arrays Collections or all kinds So why should you bother makeing your types Iterable? You could just return one of the iterable types. And clients would still get to use the nice for-loops. Remember to copy or wrap modifiable objects. But consider allowing iteration over a binary tree. Or your KDTree. Why can t we lean on the existing collections? You don t want to have to copy your (possibly big) tree into another collection for each call. John Jannotti (cs32) Scope, Collections & Generics Feb 8, / 1

40 Making BitSet Iterable Java library provides BitSet A compact representation for a set of (small) integers. Uses an array of integers internally. Each 32-bit integer records the presence/absence of 32 integers. But it isn t Iterable How would we make an Iterable BitSet? What primitives do you need BitSet to have? Anything else you would like? How do you structure the classes? John Jannotti (cs32) Scope, Collections & Generics Feb 8, / 1

41 Write a test first p u b l i c v o i d t e s t C o n s t r u c t i o n ( ) { 2 I n t S e t s e t = new I n t S e t ( 2 1, 1 0, 1 3 ) ; 3 Set<I n t e g e r > hs = S e t s. newhashset ( 1 3, 1 0, 2 1 ) ; 4 a s s e r t E q u a l s ( hs. s i z e ( ), s e t. c a r d i n a l i t y ( ) ) ; 5 a s s e r t T r u e ( s e t. get ( 2 1 ) ) ; 6 a s s e r t T r u e ( s e t. get ( 1 0 ) ) ; 7 a s s e r t T r u e ( s e t. get ( 1 3 ) ) ; 8 a s s e r t F a l s e ( s e t. get ( 0 ) ) ; 9 a s s e r t F a l s e ( s e t. get ( 1 ) ) ; 0 a s s e r t F a l s e ( s e t. get ( 1 1 ) ) ; 1 2 f o r ( i n t i : s e t ) { 3 a s s e r t T r u e ( hs. c o n t a i n s ( i ) ) ; 4 hs. remove ( i ) ; 5 } 6 a s s e r t T r u e ( hs. isempty ( ) ) ; John Jannotti (cs32) Scope, Collections & Generics Feb 8, / 1

42 IntSet, an Iterable BitSet 1 p u b l i c c l a s s I n t S e t e x t e n d s B i t S e t 2 implements I t e r a b l e <I n t e g e r > { 3 p u b l i c I n t S e t ( I n t e g e r... i n t s ) { 4 s u p e r ( ) ; 5 f o r ( i n t i : i n t s ) 6 s e t ( i ) ; 7 } 8 p u b l i c I t e r a t o r <I n t e g e r > i t e r a t o r ( ) { 9 r e t u r n new I t r ( ) ; 0 } 1 p r i v a t e c l a s s I t r implements I t e r a t o r <I n t e g e r > { } 4 } John Jannotti (cs32) Scope, Collections & Generics Feb 8, / 1

43 IntSet$Itr 1 p r i v a t e c l a s s I t r implements I t e r a t o r <I n t e g e r > { 2 i n t c u r s o r = 1; 3 p u b l i c boolean hasnext ( ) { 4 r e t u r n n e x t S e t B i t ( c u r s o r +1) >= 0 ; 5 } 6 p u b l i c I n t e g e r next ( ) { 7 i n t b i t = n e x t S e t B i t ( c u r s o r +1); 8 i f ( b i t < 0) 9 throw new NoSuchElementException ( ) ; 0 c u r s o r = b i t ; 1 r e t u r n c u r s o r ; 2 } 3 p u b l i c v o i d remove ( ) { c l e a r ( c u r s o r ) ; } 4 } John Jannotti (cs32) Scope, Collections & Generics Feb 8, / 1

Announcements. John Jannotti (cs32) Design Patterns Feb 13, / 1

Announcements. John Jannotti (cs32) Design Patterns Feb 13, / 1 Announcements We ll code review Stars on Thursday. Volunteer your code by emailing me. Lab this week covers Ajax/Javascript. Interactive UIs. No lab (or lab hours) next week. Submit a group project idea

More information

1 Trees. Listing 1: Node with two child reference. public class ptwochildnode { protected Object data ; protected ptwochildnode l e f t, r i g h t ;

1 Trees. Listing 1: Node with two child reference. public class ptwochildnode { protected Object data ; protected ptwochildnode l e f t, r i g h t ; 1 Trees The next major set of data structures belongs to what s called Trees. They are called that, because if you try to visualize the structure, it kind of looks like a tree (root, branches, and leafs).

More information

MURA Office hours Thurs at 12-1pm in CIT 546 Contact for more info.

MURA Office hours Thurs at 12-1pm in CIT 546 Contact for more info. Course Announcements Lecture capture has begun, available from Lectures page. First two and a half weeks are packed. Testing lab done, HTML started, and Stars due next Friday. Department has a lot of student

More information

Math 3361-Modern Algebra Lecture 08 9/26/ Cardinality

Math 3361-Modern Algebra Lecture 08 9/26/ Cardinality Math 336-Modern Algebra Lecture 08 9/26/4. Cardinality I started talking about cardinality last time, and you did some stuff with it in the Homework, so let s continue. I said that two sets have the same

More information

Course Announcements. Bacon is due next Monday. Next lab is about drawing UIs. Today s lecture will help thinking about your DB interface.

Course Announcements. Bacon is due next Monday. Next lab is about drawing UIs. Today s lecture will help thinking about your DB interface. Course Announcements Bacon is due next Monday. Today s lecture will help thinking about your DB interface. Next lab is about drawing UIs. John Jannotti (cs32) ORMs Mar 9, 2017 1 / 24 ORMs John Jannotti

More information

Descriptive Statistics (And a little bit on rounding and significant digits)

Descriptive Statistics (And a little bit on rounding and significant digits) Descriptive Statistics (And a little bit on rounding and significant digits) Now that we know what our data look like, we d like to be able to describe it numerically. In other words, how can we represent

More information

ITI Introduction to Computing II

ITI Introduction to Computing II (with contributions from R. Holte) School of Electrical Engineering and Computer Science University of Ottawa Version of January 11, 2015 Please don t print these lecture notes unless you really need to!

More information

Computer Science Introductory Course MSc - Introduction to Java

Computer Science Introductory Course MSc - Introduction to Java Computer Science Introductory Course MSc - Introduction to Java Lecture 1: Diving into java Pablo Oliveira ENST Outline 1 Introduction 2 Primitive types 3 Operators 4 5 Control Flow

More information

Lecture 5: Sep. 23 &25

Lecture 5: Sep. 23 &25 CIS 2168 Data Structures Fall 2014 Lecturer: Anwar Mamat Lecture 5: Sep. 23 &25 Disclaimer: These notes may be distributed outside this class only with the permission of the Instructor. 5.1 Doubly Linked

More information

Voortgezet Programmeren

Voortgezet Programmeren Voortgezet Programmeren Lecture 4: Interfaces and polymorphism Tommi Tervonen Econometric Institute, Erasmus School of Economics Rule #1: never duplicate code p u b l i c c l a s s Course { p u b l i c

More information

Tou has been released!

Tou has been released! Tou has been released! Shoot- em-up, heavy use of collision detection Much more open-ended than previous projects Easier than previous projects if you work smart Should help those of you combating the

More information

ITI Introduction to Computing II

ITI Introduction to Computing II (with contributions from R. Holte) School of Electrical Engineering and Computer Science University of Ottawa Version of January 9, 2019 Please don t print these lecture notes unless you really need to!

More information

Announcements. CSE332: Data Abstractions Lecture 2: Math Review; Algorithm Analysis. Today. Mathematical induction. Dan Grossman Spring 2010

Announcements. CSE332: Data Abstractions Lecture 2: Math Review; Algorithm Analysis. Today. Mathematical induction. Dan Grossman Spring 2010 Announcements CSE332: Data Abstractions Lecture 2: Math Review; Algorithm Analysis Dan Grossman Spring 2010 Project 1 posted Section materials on using Eclipse will be very useful if you have never used

More information

Outline Inverse of a Relation Properties of Relations. Relations. Alice E. Fischer. April, 2018

Outline Inverse of a Relation Properties of Relations. Relations. Alice E. Fischer. April, 2018 Relations Alice E. Fischer April, 2018 1 Inverse of a Relation 2 Properties of Relations The Inverse of a Relation Let R be a relation from A to B. Define the inverse relation, R 1 from B to A as follows.

More information

CS173 Lecture B, November 3, 2015

CS173 Lecture B, November 3, 2015 CS173 Lecture B, November 3, 2015 Tandy Warnow November 3, 2015 CS 173, Lecture B November 3, 2015 Tandy Warnow Announcements Examlet 7 is a take-home exam, and is due November 10, 11:05 AM, in class.

More information

CS-140 Fall 2018 Test 2 Version Practice Nov. 12, Name:

CS-140 Fall 2018 Test 2 Version Practice Nov. 12, Name: CS-140 Fall 2018 Test 2 Version Practice Nov. 12, 2018 Name: 1. (10 points) For the following, Check T if the statement is true, or F if the statement is false. (a) T F : If a child overrides its parent

More information

CS-140 Fall 2018 Test 2 Version Practice Nov. 12, 2018

CS-140 Fall 2018 Test 2 Version Practice Nov. 12, 2018 CS-140 Fall 2018 Test 2 Version Practice Nov. 12, 2018 Name: 1. (10 points) For the following, Check T if the statement is true, or F if the statement is false. (a) T X F : If a child overrides its parent

More information

UI Implementation. John Jannotti. Mar 21, /course/cs0320/www/docs/lectures/ John Jannotti (cs32) UI Implementation Mar 21, / 26

UI Implementation. John Jannotti. Mar 21, /course/cs0320/www/docs/lectures/ John Jannotti (cs32) UI Implementation Mar 21, / 26 UI Implementation John Jannotti /course/cs0320/www/docs/lectures/ Mar 21, 2017 John Jannotti (cs32) UI Implementation Mar 21, 2017 1 / 26 Announcements If you won t see/work with your partner over Spring

More information

Introduction to Computing II (ITI1121) FINAL EXAMINATION

Introduction to Computing II (ITI1121) FINAL EXAMINATION Université d Ottawa Faculté de génie École de science informatique et de génie électrique University of Ottawa Faculty of engineering School of Electrical Engineering and Computer Science Identification

More information

CSE373: Data Structures and Algorithms Lecture 2: Math Review; Algorithm Analysis. Hunter Zahn Summer 2016

CSE373: Data Structures and Algorithms Lecture 2: Math Review; Algorithm Analysis. Hunter Zahn Summer 2016 CSE373: Data Structures and Algorithms Lecture 2: Math Review; Algorithm Analysis Hunter Zahn Summer 2016 Today Finish discussing stacks and queues Review math essential to algorithm analysis Proof by

More information

Data Structures and Algorithms Winter Semester

Data Structures and Algorithms Winter Semester Page 0 German University in Cairo December 26, 2015 Media Engineering and Technology Faculty Prof. Dr. Slim Abdennadher Dr. Wael Abouelsadaat Data Structures and Algorithms Winter Semester 2015-2016 Final

More information

One-to-one functions and onto functions

One-to-one functions and onto functions MA 3362 Lecture 7 - One-to-one and Onto Wednesday, October 22, 2008. Objectives: Formalize definitions of one-to-one and onto One-to-one functions and onto functions At the level of set theory, there are

More information

Maps performance tips On server: Maintain DB connections, prepared statements (per thread/request!)

Maps performance tips On server: Maintain DB connections, prepared statements (per thread/request!) Announcements Maps performance tips On server: Maintain DB connections, prepared statements (per thread/request!) Use Spark.before, Spark.after to open and close. Use ThreadLocal, or pass the connection

More information

FACULTY OF SCIENCE ACADEMY OF COMPUTER SCIENCE AND SOFTWARE ENGINEERING OBJECT ORIENTED PROGRAMMING DATE 07/2014 SESSION 8:00-10:00

FACULTY OF SCIENCE ACADEMY OF COMPUTER SCIENCE AND SOFTWARE ENGINEERING OBJECT ORIENTED PROGRAMMING DATE 07/2014 SESSION 8:00-10:00 FACULTY OF SCIENCE ACADEMY OF COMPUTER SCIENCE AND SOFTWARE ENGINEERING MODULE CAMPUS CSC2A10 OBJECT ORIENTED PROGRAMMING AUCKLAND PARK CAMPUS (APK) EXAM JULY 2014 DATE 07/2014 SESSION 8:00-10:00 ASSESOR(S)

More information

CS-140 Fall 2017 Test 1 Version Practice Practice for Nov. 20, Name:

CS-140 Fall 2017 Test 1 Version Practice Practice for Nov. 20, Name: CS-140 Fall 2017 Test 1 Version Practice Practice for Nov. 20, 2017 Name: 1. (10 points) For the following, Check T if the statement is true, the F if the statement is false. (a) T F : If a child overrides

More information

CS 4110 Programming Languages & Logics. Lecture 25 Records and Subtyping

CS 4110 Programming Languages & Logics. Lecture 25 Records and Subtyping CS 4110 Programming Languages & Logics Lecture 25 Records and Subtyping 31 October 2016 Announcements 2 Homework 6 returned: x = 34 of 37, σ = 3.8 Preliminary Exam II in class on Wednesday, November 16

More information

Q: How can quantum computers break ecryption?

Q: How can quantum computers break ecryption? Q: How can quantum computers break ecryption? Posted on February 21, 2011 by The Physicist Physicist: What follows is the famous Shor algorithm, which can break any RSA encryption key. The problem: RSA,

More information

CS Java. Introduction to Java. Andy Mroczkowski Department of Computer Science Drexel University

CS Java. Introduction to Java. Andy Mroczkowski Department of Computer Science Drexel University CS 190 - Java Introduction to Java Andy Mroczkowski uamroczk@cs.drexel.edu Department of Computer Science Drexel University February 18, 2008 / Lecture 5 Outline Course Status Course Information & Schedule

More information

Sharing Objects. Pieter van den Hombergh. Fontys Hogeschool voor Techniek en Logistiek. February 15, 2017

Sharing Objects. Pieter van den Hombergh. Fontys Hogeschool voor Techniek en Logistiek. February 15, 2017 Pieter van den Hombergh Fontys Hogeschool voor Techniek en Logistiek February 15, 2017 and /FHTenL February 15, 2017 is safe Idioms 1/34 and and is safe Idioms /FHTenL February 15, 2017 2/34 visibility

More information

Lecture 14: Nov. 11 & 13

Lecture 14: Nov. 11 & 13 CIS 2168 Data Structures Fall 2014 Lecturer: Anwar Mamat Lecture 14: Nov. 11 & 13 Disclaimer: These notes may be distributed outside this class only with the permission of the Instructor. 14.1 Sorting

More information

Sequential Circuit Analysis

Sequential Circuit Analysis Sequential Circuit Analysis Last time we started talking about latches and flip-flops, which are basic one-bit memory units. Today we ll talk about sequential circuit analysis and design. First, we ll

More information

CS221 Practice Midterm #2 Solutions

CS221 Practice Midterm #2 Solutions CS221 Practice Midterm #2 Solutions Summer 2013 Updated 4:00pm, July 24 2 [Deterministic Search] Pacfamily (20 points) Pacman is trying eat all the dots, but he now has the help of his family! There are

More information

CS 3110: Proof Strategy and Examples. 1 Propositional Logic Proof Strategy. 2 A Proof Walkthrough

CS 3110: Proof Strategy and Examples. 1 Propositional Logic Proof Strategy. 2 A Proof Walkthrough CS 3110: Proof Strategy and Examples 1 Propositional Logic Proof Strategy The fundamental thing you have to do is figure out where each connective is going to come from. Sometimes the answer is very simple;

More information

CS1800: Strong Induction. Professor Kevin Gold

CS1800: Strong Induction. Professor Kevin Gold CS1800: Strong Induction Professor Kevin Gold Mini-Primer/Refresher on Unrelated Topic: Limits This is meant to be a problem about reasoning about quantifiers, with a little practice of other skills, too

More information

Latches. October 13, 2003 Latches 1

Latches. October 13, 2003 Latches 1 Latches The second part of CS231 focuses on sequential circuits, where we add memory to the hardware that we ve already seen. Our schedule will be very similar to before: We first show how primitive memory

More information

Numerical Methods Lecture 2 Simultaneous Equations

Numerical Methods Lecture 2 Simultaneous Equations CGN 42 - Computer Methods Numerical Methods Lecture 2 Simultaneous Equations Topics: matrix operations solving systems of equations Matrix operations: Adding / subtracting Transpose Multiplication Adding

More information

Introduction to Algorithms / Algorithms I Lecturer: Michael Dinitz Topic: Intro to Learning Theory Date: 12/8/16

Introduction to Algorithms / Algorithms I Lecturer: Michael Dinitz Topic: Intro to Learning Theory Date: 12/8/16 600.463 Introduction to Algorithms / Algorithms I Lecturer: Michael Dinitz Topic: Intro to Learning Theory Date: 12/8/16 25.1 Introduction Today we re going to talk about machine learning, but from an

More information

Algebra. Here are a couple of warnings to my students who may be here to get a copy of what happened on a day that you missed.

Algebra. Here are a couple of warnings to my students who may be here to get a copy of what happened on a day that you missed. This document was written and copyrighted by Paul Dawkins. Use of this document and its online version is governed by the Terms and Conditions of Use located at. The online version of this document is

More information

CS Exam 1 Study Guide and Practice Exam

CS Exam 1 Study Guide and Practice Exam CS 150 - Exam 1 Study Guide and Practice Exam September 11, 2017 Summary 1 Disclaimer 2 Variables 2.1 Primitive Types.............................................. 2.2 Suggestions, Warnings, and Resources.................................

More information

HW8. Due: November 1, 2018

HW8. Due: November 1, 2018 CSCI 1010 Theory of Computation HW8 Due: November 1, 2018 Attach a fully filled-in cover sheet to the front of your printed homework Your name should not appear anywhere; the cover sheet and each individual

More information

Adam Blank Spring 2017 CSE 311. Foundations of Computing I. * All slides are a combined effort between previous instructors of the course

Adam Blank Spring 2017 CSE 311. Foundations of Computing I. * All slides are a combined effort between previous instructors of the course Adam Blank Spring 2017 CSE 311 Foundations of Computing I * All slides are a combined effort between previous instructors of the course HW 3 De-Brief HW 3 De-Brief PROOFS! HW 3 De-Brief Proofs This is

More information

SFWR ENG/COMP SCI 2S03 Principles of Programming

SFWR ENG/COMP SCI 2S03 Principles of Programming (Slide 1 of 78) Dr. Ridha Khedri Department of Computing and Software, McMaster University Canada L8S 4L7, Hamilton, Ontario Acknowledgments: Material based on Java actually: A Comprehensive Primer in

More information

Natural deduction for truth-functional logic

Natural deduction for truth-functional logic Natural deduction for truth-functional logic Phil 160 - Boston University Why natural deduction? After all, we just found this nice method of truth-tables, which can be used to determine the validity or

More information

ASTRO 114 Lecture Okay. We re now gonna continue discussing and conclude discussing the entire

ASTRO 114 Lecture Okay. We re now gonna continue discussing and conclude discussing the entire ASTRO 114 Lecture 55 1 Okay. We re now gonna continue discussing and conclude discussing the entire universe. So today we re gonna learn about everything, everything that we know of. There s still a lot

More information

Lecture 3. Big-O notation, more recurrences!!

Lecture 3. Big-O notation, more recurrences!! Lecture 3 Big-O notation, more recurrences!! Announcements! HW1 is posted! (Due Friday) See Piazza for a list of HW clarifications First recitation section was this morning, there s another tomorrow (same

More information

Lecture 8 HASHING!!!!!

Lecture 8 HASHING!!!!! Lecture 8 HASHING!!!!! Announcements HW3 due Friday! HW4 posted Friday! Q: Where can I see examples of proofs? Lecture Notes CLRS HW Solutions Office hours: lines are long L Solutions: We will be (more)

More information

TheFourierTransformAndItsApplications-Lecture28

TheFourierTransformAndItsApplications-Lecture28 TheFourierTransformAndItsApplications-Lecture28 Instructor (Brad Osgood):All right. Let me remind you of the exam information as I said last time. I also sent out an announcement to the class this morning

More information

Lecture 17: Trees and Merge Sort 10:00 AM, Oct 15, 2018

Lecture 17: Trees and Merge Sort 10:00 AM, Oct 15, 2018 CS17 Integrated Introduction to Computer Science Klein Contents Lecture 17: Trees and Merge Sort 10:00 AM, Oct 15, 2018 1 Tree definitions 1 2 Analysis of mergesort using a binary tree 1 3 Analysis of

More information

Computational complexity and some Graph Theory

Computational complexity and some Graph Theory Graph Theory Lars Hellström January 22, 2014 Contents of todays lecture An important concern when choosing the algorithm to use for something (after basic requirements such as correctness and stability)

More information

AP Physics Newton s Laws Wrap-up

AP Physics Newton s Laws Wrap-up AP Physics Newton s Laws Wrap-up here aren t a lot of equations in this section of the old curriculum that you ll have on your equation sheet. Just two. Here they are: F = FNet = ma Ffric N he first one

More information

Projectile Motion. v a = -9.8 m/s 2. Good practice problems in book: 3.23, 3.25, 3.27, 3.29, 3.31, 3.33, 3.43, 3.47, 3.51, 3.53, 3.

Projectile Motion. v a = -9.8 m/s 2. Good practice problems in book: 3.23, 3.25, 3.27, 3.29, 3.31, 3.33, 3.43, 3.47, 3.51, 3.53, 3. v a = -9.8 m/s 2 A projectile is anything experiencing free-fall, particularly in two dimensions. 3.23, 3.25, 3.27, 3.29, 3.31, 3.33, 3.43, 3.47, 3.51, 3.53, 3.55 Projectile Motion Good practice problems

More information

CSE373: Data Structures and Algorithms Lecture 3: Math Review; Algorithm Analysis. Catie Baker Spring 2015

CSE373: Data Structures and Algorithms Lecture 3: Math Review; Algorithm Analysis. Catie Baker Spring 2015 CSE373: Data Structures and Algorithms Lecture 3: Math Review; Algorithm Analysis Catie Baker Spring 2015 Today Registration should be done. Homework 1 due 11:59pm next Wednesday, April 8 th. Review math

More information

CS173 Strong Induction and Functions. Tandy Warnow

CS173 Strong Induction and Functions. Tandy Warnow CS173 Strong Induction and Functions Tandy Warnow CS 173 Introduction to Strong Induction (also Functions) Tandy Warnow Preview of the class today What are functions? Weak induction Strong induction A

More information

Discrete Structures Proofwriting Checklist

Discrete Structures Proofwriting Checklist CS103 Winter 2019 Discrete Structures Proofwriting Checklist Cynthia Lee Keith Schwarz Now that we re transitioning to writing proofs about discrete structures like binary relations, functions, and graphs,

More information

Student Activity: Finding Factors and Prime Factors

Student Activity: Finding Factors and Prime Factors When you have completed this activity, go to Status Check. Pre-Algebra A Unit 2 Student Activity: Finding Factors and Prime Factors Name Date Objective In this activity, you will find the factors and the

More information

Numerical Methods Lecture 2 Simultaneous Equations

Numerical Methods Lecture 2 Simultaneous Equations Numerical Methods Lecture 2 Simultaneous Equations Topics: matrix operations solving systems of equations pages 58-62 are a repeat of matrix notes. New material begins on page 63. Matrix operations: Mathcad

More information

Math (P)Review Part I:

Math (P)Review Part I: Lecture 1: Math (P)Review Part I: Linear Algebra Computer Graphics CMU 15-462/15-662, Fall 2017 Homework 0.0 (Due Monday!) Exercises will be a bit harder / more rigorous than what you will do for the rest

More information

Lesson 21 Not So Dramatic Quadratics

Lesson 21 Not So Dramatic Quadratics STUDENT MANUAL ALGEBRA II / LESSON 21 Lesson 21 Not So Dramatic Quadratics Quadratic equations are probably one of the most popular types of equations that you ll see in algebra. A quadratic equation has

More information

KIRCHHOFF S LAWS. Learn how to analyze more complicated circuits with more than one voltage source and numerous resistors.

KIRCHHOFF S LAWS. Learn how to analyze more complicated circuits with more than one voltage source and numerous resistors. KIRCHHOFF S LAWS Lab Goals: Learn how to analyze more complicated circuits with more than one voltage source and numerous resistors. Lab Notebooks: Write descriptions of all of your experiments in your

More information

Computer Systems on the CERN LHC: How do we measure how well they re doing?

Computer Systems on the CERN LHC: How do we measure how well they re doing? Computer Systems on the CERN LHC: How do we measure how well they re doing? Joshua Dawes PhD Student affiliated with CERN & Manchester My research pages: http://cern.ch/go/ggh8 Purpose of this talk Principally

More information

Chapter Finding parse trees

Chapter Finding parse trees Chapter 16 NP Some tasks definitely require exponential time. That is, we can not only display an exponential-time algorithm, but we can also prove that the problem cannot be solved in anything less than

More information

Lecture 1: Asymptotic Complexity. 1 These slides include material originally prepared by Dr.Ron Cytron, Dr. Jeremy Buhler, and Dr. Steve Cole.

Lecture 1: Asymptotic Complexity. 1 These slides include material originally prepared by Dr.Ron Cytron, Dr. Jeremy Buhler, and Dr. Steve Cole. Lecture 1: Asymptotic Complexity 1 These slides include material originally prepared by Dr.Ron Cytron, Dr. Jeremy Buhler, and Dr. Steve Cole. Announcements TA office hours officially start this week see

More information

An Intuitive Introduction to Motivic Homotopy Theory Vladimir Voevodsky

An Intuitive Introduction to Motivic Homotopy Theory Vladimir Voevodsky What follows is Vladimir Voevodsky s snapshot of his Fields Medal work on motivic homotopy, plus a little philosophy and from my point of view the main fun of doing mathematics Voevodsky (2002). Voevodsky

More information

PHYSICS 15a, Fall 2006 SPEED OF SOUND LAB Due: Tuesday, November 14

PHYSICS 15a, Fall 2006 SPEED OF SOUND LAB Due: Tuesday, November 14 PHYSICS 15a, Fall 2006 SPEED OF SOUND LAB Due: Tuesday, November 14 GENERAL INFO The goal of this lab is to determine the speed of sound in air, by making measurements and taking into consideration the

More information

Solving with Absolute Value

Solving with Absolute Value Solving with Absolute Value Who knew two little lines could cause so much trouble? Ask someone to solve the equation 3x 2 = 7 and they ll say No problem! Add just two little lines, and ask them to solve

More information

CS173 Lecture B, September 10, 2015

CS173 Lecture B, September 10, 2015 CS173 Lecture B, September 10, 2015 Tandy Warnow September 11, 2015 CS 173, Lecture B September 10, 2015 Tandy Warnow Examlet Today Four problems: One induction proof One problem on simplifying a logical

More information

Grades 7 & 8, Math Circles 10/11/12 October, Series & Polygonal Numbers

Grades 7 & 8, Math Circles 10/11/12 October, Series & Polygonal Numbers Faculty of Mathematics Waterloo, Ontario N2L G Centre for Education in Mathematics and Computing Introduction Grades 7 & 8, Math Circles 0//2 October, 207 Series & Polygonal Numbers Mathematicians are

More information

Big Bang, Black Holes, No Math

Big Bang, Black Holes, No Math ASTR/PHYS 109 Dr. David Toback Lectures 16 & 17 1 Was due Today L17 Reading: (BBBHNM Unit 2) Pre-Lecture Reading Questions: Let us know if you were misgraded on any submissions End-of-Chapter Quizzes:

More information

CSE 373: Data Structures and Algorithms Pep Talk; Algorithm Analysis. Riley Porter Winter 2017

CSE 373: Data Structures and Algorithms Pep Talk; Algorithm Analysis. Riley Porter Winter 2017 CSE 373: Data Structures and Algorithms Pep Talk; Algorithm Analysis Riley Porter Announcements Op4onal Java Review Sec4on: PAA A102 Tuesday, January 10 th, 3:30-4:30pm. Any materials covered will be posted

More information

ASTRO 114 Lecture gonna be talking about individual galaxies, but we re gonna be talking about the whole

ASTRO 114 Lecture gonna be talking about individual galaxies, but we re gonna be talking about the whole ASTRO 114 Lecture 53 1 Okay. We re now going to turn our attention to the entire universe. We re not just gonna be talking about individual galaxies, but we re gonna be talking about the whole thing. I

More information

CSE332: Data Structures & Parallelism Lecture 2: Algorithm Analysis. Ruth Anderson Winter 2019

CSE332: Data Structures & Parallelism Lecture 2: Algorithm Analysis. Ruth Anderson Winter 2019 CSE332: Data Structures & Parallelism Lecture 2: Algorithm Analysis Ruth Anderson Winter 2019 Today Algorithm Analysis What do we care about? How to compare two algorithms Analyzing Code Asymptotic Analysis

More information

Astronomical Distances. Astronomical Distances 1/30

Astronomical Distances. Astronomical Distances 1/30 Astronomical Distances Astronomical Distances 1/30 Last Time We ve been discussing methods to measure lengths and objects such as mountains, trees, and rivers. Today we ll look at some more difficult problems.

More information

(Refer Slide Time: 0:21)

(Refer Slide Time: 0:21) Theory of Computation Prof. Somenath Biswas Department of Computer Science and Engineering Indian Institute of Technology Kanpur Lecture 7 A generalisation of pumping lemma, Non-deterministic finite automata

More information

Deterministic Finite Automaton (DFA)

Deterministic Finite Automaton (DFA) 1 Lecture Overview Deterministic Finite Automata (DFA) o accepting a string o defining a language Nondeterministic Finite Automata (NFA) o converting to DFA (subset construction) o constructed from a regular

More information

Lecture 2. More Algorithm Analysis, Math and MCSS By: Sarah Buchanan

Lecture 2. More Algorithm Analysis, Math and MCSS By: Sarah Buchanan Lecture 2 More Algorithm Analysis, Math and MCSS By: Sarah Buchanan Announcements Assignment #1 is posted online It is directly related to MCSS which we will be talking about today or Monday. There are

More information

3) x -7 4) 3 < x. When multiplying or dividing by a NEGATIVE number, we SWITCH the inequality sign!

3) x -7 4) 3 < x. When multiplying or dividing by a NEGATIVE number, we SWITCH the inequality sign! Name: Date: / / WARM UP 1) What is the difference between an inequality and an equation.? QUIZ DAY! 2) One must be at least 35 years old in order to be president of the United States. If x represents age,

More information

You separate binary numbers into columns in a similar fashion. 2 5 = 32

You separate binary numbers into columns in a similar fashion. 2 5 = 32 RSA Encryption 2 At the end of Part I of this article, we stated that RSA encryption works because it s impractical to factor n, which determines P 1 and P 2, which determines our private key, d, which

More information

Chapter Finding parse trees

Chapter Finding parse trees Chapter 16 NP Some tasks definitely require exponential time. That is, we can not only display an exponential-time algorithm, but we can also prove that the problem cannot be solved in anything less than

More information

CS1083 Week 4 : Polymorphism

CS1083 Week 4 : Polymorphism CS1083 Week 4 : Polymorphism Interfaces, Comparable, Searching David Bremner 2018-01-22 Interfaces Linear Search Binary Search Interfaces An interface is like a class, with all the implementation left

More information

Unit #2: Linear and Exponential Functions Lesson #13: Linear & Exponential Regression, Correlation, & Causation. Day #1

Unit #2: Linear and Exponential Functions Lesson #13: Linear & Exponential Regression, Correlation, & Causation. Day #1 Algebra I Name Unit #2: Linear and Exponential Functions Lesson #13: Linear & Exponential Regression, Correlation, & Causation Day #1 Period Date When a table of values increases or decreases by the same

More information

1. Write a program to calculate distance traveled by light

1. Write a program to calculate distance traveled by light G. H. R a i s o n i C o l l e g e O f E n g i n e e r i n g D i g d o h H i l l s, H i n g n a R o a d, N a g p u r D e p a r t m e n t O f C o m p u t e r S c i e n c e & E n g g P r a c t i c a l M a

More information

Chemical Applications of Symmetry and Group Theory Prof. Manabendra Chandra Department of Chemistry Indian Institute of Technology, Kanpur.

Chemical Applications of Symmetry and Group Theory Prof. Manabendra Chandra Department of Chemistry Indian Institute of Technology, Kanpur. Chemical Applications of Symmetry and Group Theory Prof. Manabendra Chandra Department of Chemistry Indian Institute of Technology, Kanpur Lecture 08 Hello and welcome to the day 3 of the second week of

More information

After that, we will introduce more ideas from Chapter 5: Number Theory. Your quiz in recitation tomorrow will involve writing proofs like those.

After that, we will introduce more ideas from Chapter 5: Number Theory. Your quiz in recitation tomorrow will involve writing proofs like those. Wednesday, Oct 17 Today we will finish Course Notes 3.2: Methods of Proof. After that, we will introduce more ideas from Chapter 5: Number Theory. The exercise generator Methods of Proof, 3.2 (also includes

More information

Chemical Applications of Symmetry and Group Theory Prof. Manabendra Chandra Department of Chemistry Indian Institute of Technology, Kanpur

Chemical Applications of Symmetry and Group Theory Prof. Manabendra Chandra Department of Chemistry Indian Institute of Technology, Kanpur Chemical Applications of Symmetry and Group Theory Prof. Manabendra Chandra Department of Chemistry Indian Institute of Technology, Kanpur Lecture - 09 Hello, welcome to the day 4 of our second week of

More information

Basic Java OOP 10/12/2015. Department of Computer Science & Information Engineering. National Taiwan University

Basic Java OOP 10/12/2015. Department of Computer Science & Information Engineering. National Taiwan University Basic Java OOP 10/12/2015 Hsuan-Tien Lin ( 林軒田 ) htlin@csie.ntu.edu.tw Department of Computer Science & Information Engineering National Taiwan University ( 國立台灣大學資訊工程系 ) Hsuan-Tien Lin (NTU CSIE) Basic

More information

CS1210 Lecture 23 March 8, 2019

CS1210 Lecture 23 March 8, 2019 CS1210 Lecture 23 March 8, 2019 HW5 due today In-discussion exams next week Optional homework assignment next week can be used to replace a score from among HW 1 3. Will be posted some time before Monday

More information

Sequential Logic (3.1 and is a long difficult section you really should read!)

Sequential Logic (3.1 and is a long difficult section you really should read!) EECS 270, Fall 2014, Lecture 6 Page 1 of 8 Sequential Logic (3.1 and 3.2. 3.2 is a long difficult section you really should read!) One thing we have carefully avoided so far is feedback all of our signals

More information

C if U can. Algebra. Name

C if U can. Algebra. Name C if U can Algebra Name.. How will this booklet help you to move from a D to a C grade? The topic of algebra is split into six units substitution, expressions, factorising, equations, trial and improvement

More information

It ain t no good if it ain t snappy enough. (Efficient Computations) COS 116, Spring 2011 Sanjeev Arora

It ain t no good if it ain t snappy enough. (Efficient Computations) COS 116, Spring 2011 Sanjeev Arora It ain t no good if it ain t snappy enough. (Efficient Computations) COS 116, Spring 2011 Sanjeev Arora Administrative stuff Readings avail. from course web page Feedback form on course web page; fully

More information

Water tank. Fortunately there are a couple of objectors. Why is it straight? Shouldn t it be a curve?

Water tank. Fortunately there are a couple of objectors. Why is it straight? Shouldn t it be a curve? Water tank (a) A cylindrical tank contains 800 ml of water. At t=0 (minutes) a hole is punched in the bottom, and water begins to flow out. It takes exactly 100 seconds for the tank to empty. Draw the

More information

AN ALGEBRA PRIMER WITH A VIEW TOWARD CURVES OVER FINITE FIELDS

AN ALGEBRA PRIMER WITH A VIEW TOWARD CURVES OVER FINITE FIELDS AN ALGEBRA PRIMER WITH A VIEW TOWARD CURVES OVER FINITE FIELDS The integers are the set 1. Groups, Rings, and Fields: Basic Examples Z := {..., 3, 2, 1, 0, 1, 2, 3,...}, and we can add, subtract, and multiply

More information

Binary addition example worked out

Binary addition example worked out Binary addition example worked out Some terms are given here Exercise: what are these numbers equivalent to in decimal? The initial carry in is implicitly 0 1 1 1 0 (Carries) 1 0 1 1 (Augend) + 1 1 1 0

More information

Calculus II. Calculus II tends to be a very difficult course for many students. There are many reasons for this.

Calculus II. Calculus II tends to be a very difficult course for many students. There are many reasons for this. Preface Here are my online notes for my Calculus II course that I teach here at Lamar University. Despite the fact that these are my class notes they should be accessible to anyone wanting to learn Calculus

More information

Lecture 4: Constructing the Integers, Rationals and Reals

Lecture 4: Constructing the Integers, Rationals and Reals Math/CS 20: Intro. to Math Professor: Padraic Bartlett Lecture 4: Constructing the Integers, Rationals and Reals Week 5 UCSB 204 The Integers Normally, using the natural numbers, you can easily define

More information

Minilecture 2: Sorting Algorithms

Minilecture 2: Sorting Algorithms Math/CCS 10 Professor: Padraic Bartlett Minilecture 2: Sorting Algorithms Week 1 UCSB 201 On Monday s homework, we looked at an algorithm designed to sort a list! In this class, we will study several such

More information

Introduction to Computing II (ITI 1121) FINAL EXAMINATION

Introduction to Computing II (ITI 1121) FINAL EXAMINATION Université d Ottawa Faculté de génie École de science informatique et de génie électrique University of Ottawa Faculty of engineering School of Electrical Engineering and Computer Science Identification

More information

Chapter 1 Review of Equations and Inequalities

Chapter 1 Review of Equations and Inequalities Chapter 1 Review of Equations and Inequalities Part I Review of Basic Equations Recall that an equation is an expression with an equal sign in the middle. Also recall that, if a question asks you to solve

More information

Newton s Law of Motion

Newton s Law of Motion Newton s Law of Motion Physics 211 Syracuse University, Physics 211 Spring 2019 Walter Freeman February 11, 2019 W. Freeman Newton s Law of Motion February 11, 2019 1 / 1 Announcements Homework 3 due Friday

More information

Transcription of Science Time video Spring and Flowers

Transcription of Science Time video Spring and Flowers Transcription of Science Time video Spring and Flowers The video for this transcript can be found on the Questacon website at: http://canberra.questacon.edu.au/sciencetime/ Transcription from video: Hi,

More information

CS 170 Algorithms Spring 2009 David Wagner Final

CS 170 Algorithms Spring 2009 David Wagner Final CS 170 Algorithms Spring 2009 David Wagner Final PRINT your name:, (last) SIGN your name: (first) PRINT your Unix account login: Your TA s name: Name of the person sitting to your left: Name of the person

More information