1. Introduction. COS 126* Princeton University Fall Overview. Kevin Wayne. Grades. The Usual Suspects

Size: px
Start display at page:

Download "1. Introduction. COS 126* Princeton University Fall Overview. Kevin Wayne. Grades. The Usual Suspects"

Transcription

1 Overview 1. Introduction What is COS 126? Broad, but technical, intro to CS in the context of scientific, engineering, and commercial applications. No prerequisites, intended for novices. COS 126* Princeton University Fall 2004 Kevin Wayne * Some lectures overlap with CHM/COS/MOL/PHY 232 Goals. Empower you to exploit available technology. Demystify computer systems. Build awareness of substantial intellectual underpinnings. Topics. Programming in Java. Machine architecture. Theory of computation. Applications. Introduction to Computer Science Robert Sedgewick and Kevin Wayne 2 The Usual Suspects Grades Lectures: Kevin Wayne. Tuesdays and Thursdays, 10:00-10:50, Frist 302. Course grades. No preset curve or quota. Precepts: Chris Bienia, Eden Chlamtac, Chris De Coro, Donna Gabai, Elena Nabieva, Kevin Wayne. COS 126: Fridays and Mondays. CHM/COS/MOL/PHY 232: Thursday. Tips on assignments, worked examples, clarify lecture material. Programming assignments: 40% (can drop lowest one) 2 exams: 50% Final project: 10% Staff discretion. Adjust borderline cases. Friend 016/017 lab: Undergrad lab assistants. Weekday evenings, weekend afternoons. Full schedule to be posted on Web. you are here 3 4

2 Course Materials Programming Assignments Course website. Programming assignments. Lecture notes. Exam archive. Required readings. Sedgewick and Wayne. Intro to Computer Science. draft of some sections: Pequod copy booksite: Recommended readings. (U-Store) King. Java Programming From the Beginning. Harel. What computers can't do. Desiderata. Address an important scientific or commercial problem. Illustrate the importance of a fundamental CS concept. Examples. YOU build tools and solve REAL N-body simulation. scientific and commercial problems. DNA sequence alignment. Digital signal processing of MP3 files. Traveling salesperson problem. Markov model of natural language. Due: Wednesdays 11:59pm via Web submission. Computing equipment. Your machine. (Linux, OS X, Unix, Windows, Java cell phone,... ) OIT machines. (Friend 016 and 017 labs). 5 6 What's Ahead? Thursday. CHM/COS/MOL/PHY 232 meets in Icahn atrium at 1:30. A Simple Machine Friday. COS 126 precept meets in Friend 11x. If not in precept (e.g., all first-years), request one today. Check course web page at midnight for precept assignments. Weekend. Read sections of Intro to CS. Monday. Optional COS 126 precept meets in Friend 11x. Tuesday. Lecture 2: Introduction to Java. Due Wednesday. Assignment 0. Setup Java programming environment. Lots of help available, don't be bashful. END OF ADMINISTRATIVE STUFF 7 Introduction to Computer Science Robert Sedgewick and Kevin Wayne

3 Secure Chat A Cryptographic Example Alice wants to send a secret to Bob? Can you read the secret gx76w3v7k? But Bob can. How? How to make a simple machine that produces "random" bits. Linear feedback shift register. Linear congruential generator. What we can do with it. Encrypt and rypt secret s. Encrypt DVDs with CSS. Decrypt DVDs with DeCSS! Use as subroutine in military cryptosystems. Science behind it Encryption Machine Digital Data Goal: design a machine to encrypt and rypt data. encrypt Computers store all data as a sequence of bits. Text. Images (JPEG), audio (MP3), video (DivX). Programs. Bit = 0 or 1 rypt Base64 encoding: use 6 bits to represent each alphanumeric symbol

4 1. Convert text to N bits. One-Time Pad Encryption Bit = 0 or 1 Y One-Time Pad Encryption 1. Convert text to N bits. 2. Generate N (one-time pad) Are these 2000 numbers random? Random Numbers If not, what is the pattern? One-Time Pad Encryption 1. Convert text to N bits. 2. Generate N (one-time pad). 3. Take bitwise XOR of two strings. Sum pair of bits (1 if sum is odd, 0 if even). XOR Truth Table x y x ^ y XOR 18 19

5 One-Time Pad Encryption One-Time Pad Decryption 1. Convert text to N bits. 2. Generate N (one-time pad). 3. Take bitwise XOR of two strings. 4. Convert back into text. X Convert encrypted to. X encrypted XOR encrypted One-Time Pad Decryption Why Does It Work? 1. Convert encrypted to. 2. Use same N (one-time pad). 3. Take bitwise XOR of two strings. 4. Convert back into text. Y Notation a b ^ Meaning original one-time pad XOR operator a ^ b encrypted encrypted (a ^ b) ^ b rypted Crucial property: (a ^ b) ^ b = a. Decrypted = original. XOR Why is crucial property true? Use properties of XOR. (a ^ b) ^ b = a ^ (b ^ b) = a ^ 0 = a always

6 A Cryptographic Example Shift Register How to make a simple machine that produces "random" bits. Linear feedback shift register. Linear congruential generator. What we can do with it. Encrypt and rypt secret s. Encrypt DVDs with CSS. Decrypt DVDs with DeCSS! Use as subroutine in military cryptosystems. Science behind it. Shift register terminology. Bit: 0 or 1. Cell: storage element that holds one bit. Register: sequence of cells. Seed: initial sequence of bits. Shift register: when clock ticks, bits propagate one position to left time t ? time t + 1 register Linear Feedback Shift Register Linear feedback shift register. 11 bit shift register. New output bit 0 is XOR of previous bits 8 and 10. LFSR demo Output bit = bit 0. ^ b 10 b 9 b 8 b 7 b 6 b 5 b 4 b 3 b 2 b 1 b 0 time t b 9 b 8 b 7 b 6 b 2 b 1 b 8^b 10 time t + 1 b 5 b 4 b 3 b 0 Are these 2000 numbers random? Random Numbers No. This is output of an bit LFSR!

7 The Science Behind It LFSR and "General Purpose Computer" Are the bits really random? No! Real machines are deterministic. fill in answer How did the computer scientist die in the shower? The instructions on the shampoo read "lather, rinse, repeat." Important properties. Built from simple components. Scales to handle huge problems. Requires a deep understanding to use effectively. Will bit pattern repeat itself? Yes, after = 2047 steps. What if I need more bits? Scalable: 20 cells for 1 million bits, 30 for 1 billion. Basic Component Control Clock Memory Input LFSR Start, stop, load Regular pulse 11 bits Seed Computer same 2.8 GHz pulse 1 GB Sequence of bits Will the machine work equally well if we XOR bits 4 and 10? No, need to understand theory of abstract rings. Computation Output Shift, XOR Pseudo- Logic, arithmetic,... Sequence of bits How many cells do I need to guarantee a certain level of security? Subject of active research. Critical difference. General purpose machine can be programmed to simulate ANY abstract machine Simulating The Abstract Machine in Java Java program prints same bits as LFBSR. You'll understand this program by next week. public class LFBSR { public static void main(string[] args) { int N = Integer.parseInt(args[0]); boolean b10 = false, b9 = true, b8 = true, b7 = false; boolean b6 = true, b5 = false, b4 = false, b3 = false; boolean b2 = false, b1 = true, b0 = false; for (int i = 0; i < N; i++) { boolean bit = b8 ^ b10; b10 = b9; b9 = b8; b8 = b7; b7 = b6; b6 = b5; b5 = b4; b4 = b3; b3 = b2; b2 = b1; b1 = b0; b0 = bit; update } } if (bit) System.out.print(1); else System.out.print(0); } System.out.println(); print % java LFBSR

General Computer Science Princeton University Spring Kevin Wayne

General Computer Science Princeton University Spring Kevin Wayne General Computer Science Princeton University Spring 2009 Kevin Wayne 1 Overview What is COS 126? Broad, but technical, intro to CS. Goals.! Demystify computer systems.! Empower you to exploit available

More information

CS 112 Introduction to Programming

CS 112 Introduction to Programming CS 112 Introduction to Programming (Spring 2012) Lecture #20: LFSR Data Type Zhong Shao Department of Computer Science Yale University Office: 314 Watson http://flint.cs.yale.edu/cs112 Acknowledgements:

More information

COS 126. General Computer Science Fall Robert Sedgewick. Overview. Grades. The Basics

COS 126. General Computer Science Fall Robert Sedgewick. Overview. Grades. The Basics Overview COS 126 What is COS 126? Broad, but technical, introduction to computer science. Goals. Demystify computer systems. Empower you to exploit available technology. Build awareness of substantial

More information

Secure Chat. Key point Without the pad, Eve cannot understand the message. Encrypt SENDMONEY with yt25a5y/s. Decrypt gx76w3v7k with yt25a5y/s

Secure Chat. Key point Without the pad, Eve cannot understand the message. Encrypt SENDMONEY with yt25a5y/s. Decrypt gx76w3v7k with yt25a5y/s Secure Chat Alice wants to send a secret message to Bob? Sometime in the past, they exchange a one-time pad Alice uses the pad to encrypt the message Bob uses the same pad to decrypt the message Encrypt

More information

General Computer Science Princeton University Spring Douglas Clark

General Computer Science Princeton University Spring Douglas Clark General Computer Science Princeton University Spring 2014 Douglas Clark 1 0. Prologue: A Simple Machine 3 Secure Chat Alice wants to send a secret message to Bob Can you read the secret message gx76w3v7k?

More information

General Computer Science Princeton University Spring Douglas Clark

General Computer Science Princeton University Spring Douglas Clark General Computer Science Princeton University Spring 2013 Douglas Clark 1 0. Prologue: A Simple Machine 2 Secure Chat Alice wants to send a secret message to Bob Can you read the secret message gx76w3v7k

More information

ASSIGNMENT 5 TIPS AND TRICKS

ASSIGNMENT 5 TIPS AND TRICKS ASSIGNMENT 5 TIPS AND TRICKS linear-feedback shift registers Java implementation a simple encryption scheme http://princeton.edu/~cos26 Last updated on /26/7 : PM Goals OOP: implement a data type; write

More information

1.4 Arrays. A Foundation for Programming. Arrays. Many Variables of the Same Type. This lecture. Store and manipulate huge quantities of data.

1.4 Arrays. A Foundation for Programming. Arrays. Many Variables of the Same Type. This lecture. Store and manipulate huge quantities of data. A Foundation for Programming 1.4 Arrays any program you might want to write objects functions and modules graphics, sound, and image I/O arrays store and manipulate huge quantities of data conditionals

More information

Introduction to Data Structures

Introduction to Data Structures 15-121 Introduction to Data Structures Lecture #1 Introduction 28 August 2019 Margaret Reid-Miller Today Course Administration Overview of Course A (very basic) Java introduction Course website: www.cs.cmu.edu/~mrmiller/15-121

More information

Announcements. 1. Forms to return today after class:

Announcements. 1. Forms to return today after class: Announcements Handouts (3) to pick up 1. Forms to return today after class: Pretest (take during class later) Laptop information form (fill out during class later) Academic honesty form (must sign) 2.

More information

Lecture 3: Loops. While Loops. While Loops: Powers of Two. While Loops: Newton-Raphson Method

Lecture 3: Loops. While Loops. While Loops: Powers of Two. While Loops: Newton-Raphson Method While Loops Lecture : Loops The while loop is a common repetition structure. Check loop-continuation condition. Execute a sequence of statements. Repeat. while (boolean expression) statement; while loop

More information

CS 112 Introduction to Programming. Final Review. Topic: Static/Instance Methods/Variables: I am confused

CS 112 Introduction to Programming. Final Review. Topic: Static/Instance Methods/Variables: I am confused Overview Course Overview (From Lecture 1) CS 112 Introduction to Programming What is CS112? What is COS 126? Broad, but technical, intro to computer science. A broad, programming-centric introduction to

More information

2/15/12. CS 112 Introduction to Programming. Lecture #16: Modular Development & Decomposition. Stepwise Refinement. Zhong Shao

2/15/12. CS 112 Introduction to Programming. Lecture #16: Modular Development & Decomposition. Stepwise Refinement. Zhong Shao 2/15/12 Stepwise Refinement CS 112 Introduction to Programming main idea: use functions to divide a large programming problem into smaller pieces that are individually easy to understand ------decomposition

More information

COS 126 Exam Review. Exams overview Example programming exam Example written exam questions (part 1)

COS 126 Exam Review. Exams overview Example programming exam Example written exam questions (part 1) COS 126 Exam Review Exams overview Example programming exam Example written exam questions (part 1) Exams overview (revisited) We have exams in the fall Two written exams. Two programming exams. Prep sessions

More information

Bjarne Stroustrup. creator of C++

Bjarne Stroustrup. creator of C++ We Continue GEEN163 I have always wished for my computer to be as easy to use as my telephone; my wish has come true because I can no longer figure out how to use my telephone. Bjarne Stroustrup creator

More information

C212 Early Evaluation Exam Mon Feb Name: Please provide brief (common sense) justifications with your answers below.

C212 Early Evaluation Exam Mon Feb Name: Please provide brief (common sense) justifications with your answers below. C212 Early Evaluation Exam Mon Feb 10 2014 Name: Please provide brief (common sense) justifications with your answers below. 1. What is the type (and value) of this expression: 5 * (7 + 4 / 2) 2. What

More information

Due: March 8, 11:59pm. Project 1

Due: March 8, 11:59pm. Project 1 COS 433: Cryptography (Spring 2018) Project 1 Princeton University Due: March 8, 11:59pm Project 1 Introduction You are interning at the super secretive SLA (Three Letter Agency). The SLA has intercepted

More information

Computer Science is...

Computer Science is... Computer Science is... Automated Software Verification Using mathematical logic, computer scientists try to design tools to automatically detect runtime and logical errors in huge, complex programs. Right:

More information

Topic 4 Expressions and variables

Topic 4 Expressions and variables Topic 4 Expressions and variables "Once a person has understood the way variables are used in programming, he has understood the quintessence of programming." -Professor Edsger W. Dijkstra Based on slides

More information

4.1 Performance. Running Time. The Challenge. Scientific Method

4.1 Performance. Running Time. The Challenge. Scientific Method Running Time 4.1 Performance As soon as an Analytic Engine exists, it will necessarily guide the future course of the science. Whenever any result is sought by its aid, the question will arise by what

More information

Physics 2660: Fundamentals of Scientific Computing. Lecture 7 Instructor: Prof. Chris Neu

Physics 2660: Fundamentals of Scientific Computing. Lecture 7 Instructor: Prof. Chris Neu Physics 2660: Fundamentals of Scientific Computing Lecture 7 Instructor: Prof. Chris Neu (chris.neu@virginia.edu) Reminder HW06 due Thursday 15 March electronically by noon HW grades are starting to appear!

More information

CS 112 Introduction to Programming

CS 112 Introduction to Programming CS 112 Introduction to Programming (Spring 2012) Lecture #9: Arrays Zhong Shao Department of Computer Science Yale University Office: 314 Watson http://flint.cs.yale.edu/cs112 Acknowledgements: some slides

More information

COS 126 General Computer Science Fall Programming Exam 2

COS 126 General Computer Science Fall Programming Exam 2 COS 126 General Computer Science Fall 2013 Programming Exam 2 This programming exam has 2 parts, weighted as indicated. The exam is semi-open: you may use the course website, the booksite, any direct links

More information

Project #2: Linear Feedback Shift Register

Project #2: Linear Feedback Shift Register BHSEC Queens Object-Oriented Programming Spring 2015 Project #2: Linear Feedback Shift Register Introduction1 A register is a small amount of storage on a digital processor. In this project, we will think

More information

More Examples Using Functions and Command-Line Arguments in C++ CS 16: Solving Problems with Computers I Lecture #6

More Examples Using Functions and Command-Line Arguments in C++ CS 16: Solving Problems with Computers I Lecture #6 More Examples Using Functions and Command-Line Arguments in C++ CS 16: Solving Problems with Computers I Lecture #6 Ziad Matni Dept. of Computer Science, UCSB Administrative CHANGED T.A. OFFICE/OPEN LAB

More information

Running Time. Analytic Engine. Charles Babbage (1864) how many times do you have to turn the crank?

Running Time. Analytic Engine. Charles Babbage (1864) how many times do you have to turn the crank? 4.1 Performance Introduction to Programming in Java: An Interdisciplinary Approach Robert Sedgewick and Kevin Wayne Copyright 2002 2010 3/30/11 8:32 PM Running Time As soon as an Analytic Engine exists,

More information

CS 112 Introduction to Programming. (Spring 2012)

CS 112 Introduction to Programming. (Spring 2012) CS 112 Introduction to Programming (Spring 2012) Lecture #38: Final Review; Critter Tournament Zhong Shao Department of Computer Science Yale University Office: 314 Watson http://flint.cs.yale.edu/cs112

More information

H212 Introduction to Software Systems Honors

H212 Introduction to Software Systems Honors Introduction to Software Systems Honors Lecture #04: Fall 2015 1/20 Office hours Monday, Wednesday: 10:15 am to 12:00 noon Tuesday, Thursday: 2:00 to 3:45 pm Office: Lindley Hall, Room 401C 2/20 Printing

More information

Lecture 3: Loops. While Loops. While Loops: Newton-Raphson Method. While Loops: Powers of Two

Lecture 3: Loops. While Loops. While Loops: Newton-Raphson Method. While Loops: Powers of Two While Loops Lecture 3: Loops The while loop is a common repetition structure. Check loop-continuation condition. Execute a sequence of statements. Repeat. while (boolean expression) statement; while loop

More information

Administration. Exceptions. Leftovers. Agenda. When Things Go Wrong. Handling Errors. CS 99 Summer 2000 Michael Clarkson Lecture 11

Administration. Exceptions. Leftovers. Agenda. When Things Go Wrong. Handling Errors. CS 99 Summer 2000 Michael Clarkson Lecture 11 Administration Exceptions CS 99 Summer 2000 Michael Clarkson Lecture 11 Lab 10 due tomorrow No lab tomorrow Work on final projects Remaining office hours Rick: today 2-3 Michael: Thursday 10-noon, Monday

More information

MTAT Applied Cryptography

MTAT Applied Cryptography MTAT.07.017 Applied Cryptography Introduction, Randomness, One-Time Pad, Stream Ciphers University of Tartu Spring 2014 1 / 31 Who am I Arnis Paršovs MSc in Cyber Security Tallinn University of Technology,

More information

JAVA OPERATORS GENERAL

JAVA OPERATORS GENERAL JAVA OPERATORS GENERAL Java provides a rich set of operators to manipulate variables. We can divide all the Java operators into the following groups: Arithmetic Operators Relational Operators Bitwise Operators

More information

School of Computer Science CPS109 Course Notes 6 Alexander Ferworn Updated Fall 15. CPS109 Course Notes 6. Alexander Ferworn

School of Computer Science CPS109 Course Notes 6 Alexander Ferworn Updated Fall 15. CPS109 Course Notes 6. Alexander Ferworn CPS109 Course Notes 6 Alexander Ferworn Unrelated Facts Worth Remembering Use metaphors to understand issues and explain them to others. Look up what metaphor means. Table of Contents Contents 1 ITERATION...

More information

Week 1 Exercises. All cs121 exercise and homework programs must in the default package and use the class names as given.

Week 1 Exercises. All cs121 exercise and homework programs must in the default package and use the class names as given. Week 1 Exercises Monday: MLK Day Unclear about building access and lab access Best case: Lab is open with TAs: 4 6 pm (Binh), 6 8 (Hoang) Worst case: locked building, lab TAs at Piazza Week 1 exercise

More information

Intensive Introduction to Computer Science. Course Overview Programming in Scratch

Intensive Introduction to Computer Science. Course Overview Programming in Scratch Unit 1, Part 1 Intensive Introduction to Computer Science Course Overview Programming in Scratch Computer Science S-111 Harvard University David G. Sullivan, Ph.D. Welcome to CS S-111! Computer science

More information

Lecture 1: Introduction

Lecture 1: Introduction Overview Lecture 1: Introduction What is COS 226? Intermediate-level survey course. Programming and problem solving with applications. Algorithms: method for solving a problem. Data structures: method

More information

CS111: PROGRAMMING LANGUAGE II

CS111: PROGRAMMING LANGUAGE II CS111: PROGRAMMING LANGUAGE II Computer Science Department Lecture 1(c): Java Basics (II) Lecture Contents Java basics (part II) Conditions Loops Methods Conditions & Branching Conditional Statements A

More information

CSCI 136 Data Structures & Advanced Programming. Fall 2018 Instructors Bill Lenhart & Bill Jannen

CSCI 136 Data Structures & Advanced Programming. Fall 2018 Instructors Bill Lenhart & Bill Jannen CSCI 136 Data Structures & Advanced Programming Fall 2018 Instructors Bill Lenhart & Bill Jannen Administrative Details Lab 1 handout is online Prelab (should be completed before lab): Lab 1 design doc

More information

! 52 playing cards in a deck. ! 5 thousand undergrads at Princeton. ! 1 million characters in a book. ! 10 million audio samples in an MP3 file.

! 52 playing cards in a deck. ! 5 thousand undergrads at Princeton. ! 1 million characters in a book. ! 10 million audio samples in an MP3 file. Arrays 1.4 Arrays This lecture. Store and manipulate huge quantities of data. Array. Indexed sequence of values of the same type. Examples.! 52 playing cards in a deck.! 5 thousand undergrads at Princeton.!

More information

4.1 Performance. Running Time. Scientific Method. Algorithmic Successes

4.1 Performance. Running Time. Scientific Method. Algorithmic Successes Running Time 4.1 Performance As soon as an Analytic Engine exists, it will necessarily guide the future course of the science. Whenever any result is sought by its aid, the question will arise - By what

More information

CS 432 Fall Mike Lam, Professor. Compilers. Advanced Systems Elective

CS 432 Fall Mike Lam, Professor. Compilers. Advanced Systems Elective CS 432 Fall 2017 Mike Lam, Professor Compilers Advanced Systems Elective Discussion question What is a compiler? Automated translation A compiler is a computer program that automatically translates other

More information

1.1 Your First Program

1.1 Your First Program 1.1 Your First Program Introduction to Programming in Java: An Interdisciplinary Approach Robert Sedgewick and Kevin Wayne Copyright 2002 2010 5/20/2013 9:37:22 AM Why Programming? Why programming? Need

More information

Inf1-OOP. Textbooks. Who and What. Organisational issues. Why Java? Course Overview. Hello, World! in Java

Inf1-OOP. Textbooks. Who and What. Organisational issues. Why Java? Course Overview. Hello, World! in Java Organisational issues Inf1-OOP Course Overview Perdita Stevens, adapting earlier version by Ewan Klein School of Informatics January 11, 2014 Why Java? Hello, World! in Java Built-in Types Integers Floating-Point

More information

CS 112 Introduction to Programming

CS 112 Introduction to Programming Running Time CS 112 Introduction to Programming As soon as an Analytic Engine exists, it will necessarily guide the future course of the science. Whenever any result is sought by its aid, the question

More information

Inf1-OOP. Textbooks. Who and What. Organizational Issues. Why Java? Course Overview. Hello, World! in Java. Ewan Klein, Perdita Stevens

Inf1-OOP. Textbooks. Who and What. Organizational Issues. Why Java? Course Overview. Hello, World! in Java. Ewan Klein, Perdita Stevens Organizational Issues Inf1-OOP Course Overview Ewan Klein, Perdita Stevens School of Informatics January 12, 2013 Why Java? Hello, World! in Java Built-in Types Integers Floating-Point Numbers Type Conversion

More information

CS 161 Computer Security. Week of September 11, 2017: Cryptography I

CS 161 Computer Security. Week of September 11, 2017: Cryptography I Weaver Fall 2017 CS 161 Computer Security Discussion 3 Week of September 11, 2017: Cryptography I Question 1 Activity: Cryptographic security levels (20 min) Say Alice has a randomly-chosen symmetric key

More information

Tips from the experts: How to waste a lot of time on this assignment

Tips from the experts: How to waste a lot of time on this assignment Com S 227 Spring 2018 Assignment 1 100 points Due Date: Friday, September 14, 11:59 pm (midnight) Late deadline (25% penalty): Monday, September 17, 11:59 pm General information This assignment is to be

More information

CSCI 136 Data Structures & Advanced Programming. Fall 2018 Instructors Bill Lenhart & Bill Jannen

CSCI 136 Data Structures & Advanced Programming. Fall 2018 Instructors Bill Lenhart & Bill Jannen CSCI 136 Data Structures & Advanced Programming Fall 2018 Instructors Bill Lenhart & Bill Jannen Administrative Details Class roster: Who s here? And who s trying to get in? Handout: Class syllabus Lecture

More information

Midterm 1 Written Exam

Midterm 1 Written Exam COS 126 Intro to CS Fall 2015 Midterm 1 Written Exam There are eight questions on this exam, weighted as indicated at the bottom of this page. There is one question per lecture, numbered corresponding

More information

Code Ninjas: Introduction to Computer Science. Macomb Science Olympiad Presented by Swati Dharia Shane Storks

Code Ninjas: Introduction to Computer Science. Macomb Science Olympiad Presented by Swati Dharia Shane Storks Code Ninjas: Introduction to Computer Science Macomb Science Olympiad Presented by Swati Dharia Shane Storks Goals of the Math Topics Learn basic math concepts used in computer science Introduce basic

More information

if Statement Numeric Rela5onal Operators The if Statement Flow of Control: Branching (Savitch, Chapter 3)

if Statement Numeric Rela5onal Operators The if Statement Flow of Control: Branching (Savitch, Chapter 3) if Statement Flow of Control: Branching (Savitch, Chapter 3) TOPICS Conditional Execution if and Statement Boolean Data switch Statement Ensures that a statement is executed only when some condi5on is

More information

if Statement Numeric Rela7onal Operators The if Statement Flow of Control: Branching (Savitch, Chapter 3)

if Statement Numeric Rela7onal Operators The if Statement Flow of Control: Branching (Savitch, Chapter 3) if Statement Flow of Control: Branching (Savitch, Chapter 3) TOPICS Conditional Execution if,, and if boolean data switch statements CS 160, Fall Semester 2015 1 Programs o-en contain statements that may

More information

COMP-202 Unit 0: Course Details

COMP-202 Unit 0: Course Details COMP-202 Unit 0: Course Details CONTENTS: Focus of the Course and Prerequisites Outline and Textbook Course Structure and Grading Scheme Computer Lab Info and Required Software Getting started thinking

More information

CS 170 Section 3, Spring 2015 Programming in Java Midterm Exam 1. Name (print):

CS 170 Section 3, Spring 2015 Programming in Java Midterm Exam 1. Name (print): Name (print): INSTRUCTIONS: o Keep your eyes on your own paper and do your best to prevent anyone else from seeing your work. o Do NOT communicate with anyone other than the professor/proctor for ANY reason

More information

What does this print?

What does this print? public class Test { int data; public Test(int x ) { data=x; } public void assign(test b, Test c, int d) { data= 2; b= new Test(2); c.data= 2; d=2; } public static void main(string [] args) { Test a, b,

More information

Recap: Assignment as an Operator CS 112 Introduction to Programming

Recap: Assignment as an Operator CS 112 Introduction to Programming Recap: Assignment as an Operator CS 112 Introduction to Programming q You can consider assignment as an operator, with a (Spring 2012) lower precedence than the arithmetic operators First the expression

More information

61A Lecture 3. Friday, September 5

61A Lecture 3. Friday, September 5 61A Lecture 3 Friday, September 5 Announcements There's plenty of room in live lecture if you want to come (but videos are still better) Please don't make noise outside of the previous lecture! Homework

More information

CS 112 Introduction to Programming

CS 112 Introduction to Programming CS 112 Introduction to Programming (Spring 2012) Lecture #5: Conditionals and Loops Zhong Shao Department of Computer Science Yale University Office: 314 Watson http://flint.cs.yale.edu/cs112 Acknowledgements:

More information

Physics 2660: Fundamentals of Scientific Computing. Lecture 3 Instructor: Prof. Chris Neu

Physics 2660: Fundamentals of Scientific Computing. Lecture 3 Instructor: Prof. Chris Neu Physics 2660: Fundamentals of Scientific Computing Lecture 3 Instructor: Prof. Chris Neu (chris.neu@virginia.edu) Announcements Weekly readings will be assigned and available through the class wiki home

More information

CONDITIONAL EXECUTION

CONDITIONAL EXECUTION CONDITIONAL EXECUTION yes x > y? no max = x; max = y; logical AND logical OR logical NOT &&! Fundamentals of Computer Science I Outline Conditional Execution if then if then Nested if then statements Comparisons

More information

Physics 2660: Fundamentals of Scientific Computing. Lecture 5 Instructor: Prof. Chris Neu

Physics 2660: Fundamentals of Scientific Computing. Lecture 5 Instructor: Prof. Chris Neu Physics 2660: Fundamentals of Scientific Computing Lecture 5 Instructor: Prof. Chris Neu (chris.neu@virginia.edu) Reminder I am back! HW04 due Thursday 22 Feb electronically by noon HW grades are coming.

More information

Running Time. Analytic Engine. Charles Babbage (1864) how many times do you have to turn the crank?

Running Time. Analytic Engine. Charles Babbage (1864) how many times do you have to turn the crank? 4.1 Performance Introduction to Programming in Java: An Interdisciplinary Approach Robert Sedgewick and Kevin Wayne Copyright 2008 March 30, 2009 7:37 tt Running Time As soon as an Analytic Engine exists,

More information

Updates. Office B116E Office Hours : Friday 1 p.m. 2 p.m. Also by appointment Office Hours Purpose:

Updates. Office B116E Office Hours : Friday 1 p.m. 2 p.m. Also by appointment Office Hours Purpose: CS 180 Amit Gupta Updates Office B116E Office Hours : Friday 1 p.m. 2 p.m. Also by appointment gupta75@purdue.edu Office Hours Purpose: Course Material and Recitation No project questions Quizzes I will

More information

last time in cs recitations. computer commands. today s topics.

last time in cs recitations. computer commands. today s topics. last time in cs1007... recitations. course objectives policies academic integrity resources WEB PAGE: http://www.columbia.edu/ cs1007 NOTE CHANGES IN ASSESSMENT 5 EXTRA CREDIT POINTS ADDED sign up for

More information

} Evaluate the following expressions: 1. int x = 5 / 2 + 2; 2. int x = / 2; 3. int x = 5 / ; 4. double x = 5 / 2.

} Evaluate the following expressions: 1. int x = 5 / 2 + 2; 2. int x = / 2; 3. int x = 5 / ; 4. double x = 5 / 2. Class #10: Understanding Primitives and Assignments Software Design I (CS 120): M. Allen, 19 Sep. 18 Java Arithmetic } Evaluate the following expressions: 1. int x = 5 / 2 + 2; 2. int x = 2 + 5 / 2; 3.

More information

CONDITIONAL EXECUTION

CONDITIONAL EXECUTION CONDITIONAL EXECUTION yes x > y? no max = x; max = y; logical AND logical OR logical NOT &&! Fundamentals of Computer Science I Outline Conditional Execution if then if then Nested if then statements Comparisons

More information

COM S 211 Computers and Programming (also ENGRD 211)

COM S 211 Computers and Programming (also ENGRD 211) COM S 211 Computers and Programming (also ENGRD 211) Fall, spring, summer. 3 credits. Prerequisite: COM S 100 or an equivalent course in Java or C++. Intermediate programming in a high-level language and

More information

Analysis of Algorithms

Analysis of Algorithms Running time Analysis of Algorithms As soon as an Analytic Engine exists, it will necessarily guide the future course of the science. Whenever any result is sought by its aid, the question will arise -

More information

CS 101 Fall 2005 Midterm 2 Name: ID:

CS 101 Fall 2005 Midterm 2 Name:  ID: This exam is open text book but closed-notes, closed-calculator, closed-neighbor, etc. Questions are worth different amounts (in particular, the final two questions are worth substantially more than any

More information

1.3 Conditionals and Loops

1.3 Conditionals and Loops 1.3 Conditionals and Loops Introduction to Programming in Java: An Interdisciplinary Approach Robert Sedgewick and Kevin Wayne Copyright 2002 2010 15/1/2013 22:16:24 A Foundation for Programming any program

More information

CS 112 Introduction to Programming

CS 112 Introduction to Programming CS 112 Introduction to Programming (Spring 2012) Lecture #7: Variable Scope, Constants, and Loops Zhong Shao Department of Computer Science Yale University Office: 314 Watson http://flint.cs.yale.edu/cs112

More information

Algorithms. Algorithms 1.4 ANALYSIS OF ALGORITHMS

Algorithms. Algorithms 1.4 ANALYSIS OF ALGORITHMS ROBERT SEDGEWICK KEVIN WAYNE Algorithms ROBERT SEDGEWICK KEVIN WAYNE 1.4 ANALYSIS OF ALGORITHMS Algorithms F O U R T H E D I T I O N http://algs4.cs.princeton.edu introduction observations mathematical

More information

Wednesday, November 5

Wednesday, November 5 Possible Date Change for Mid-Term 2 Can we shift Mid-Term 2 to Wednesday, November 5 instead of Friday, November 7? 1 Outline Encapsulation and Objects Vectors and Identity 2 Encapsulation Two lectures

More information

CS 101 Spring 2007 Midterm 2 Name: ID:

CS 101 Spring 2007 Midterm 2 Name:  ID: You only need to write your name and e-mail ID on the first page. This exam is CLOSED text book, closed-notes, closed-calculator, closed-neighbor, etc. Questions are worth different amounts, so be sure

More information

CS 161 Computer Security

CS 161 Computer Security Raluca Popa Spring 2018 CS 161 Computer Security Discussion 3 Week of February 5, 2018: Cryptography I Question 1 Activity: Cryptographic security levels (20 min) Say Alice has a randomly-chosen symmetric

More information

AP Computer Science A Summer Assignment 2017

AP Computer Science A Summer Assignment 2017 AP Computer Science A Summer Assignment 2017 The objective of this summer assignment is to ensure that each student has the ability to compile and run code on a computer system at home. We will be doing

More information

Admin. ! Assignment 3. ! due Monday at 11:59pm! one small error in 5b (fast division) that s been fixed. ! Midterm next Thursday in-class (10/1)

Admin. ! Assignment 3. ! due Monday at 11:59pm! one small error in 5b (fast division) that s been fixed. ! Midterm next Thursday in-class (10/1) Admin CS4B MACHINE David Kauchak CS 5 Fall 5! Assignment 3! due Monday at :59pm! one small error in 5b (fast division) that s been fixed! Midterm next Thursday in-class (/)! Comprehensive! Closed books,

More information

Lecture 1. Course Overview Types & Expressions

Lecture 1. Course Overview Types & Expressions Lecture 1 Course Overview Types & Expressions CS 1110 Spring 2012: Walker White Outcomes: Basics of (Java) procedural programming Usage of assignments, conditionals, and loops. Ability to write recursive

More information

2/15/2008. Announcements. Programming. Instruction Execution Engines. Following Instructions. Instruction Execution Engines. Anatomy of a Computer

2/15/2008. Announcements. Programming. Instruction Execution Engines. Following Instructions. Instruction Execution Engines. Anatomy of a Computer Programming Why is programming fun? Finally, there is the delight of working in such a tractable medium. The programmer, like the poet, works only slightly re-moved from pure thought-stuff. He builds his

More information

Debugging [continued]

Debugging [continued] 1 Debugging [continued] Admiral Grace Murray Hopper http://www.history.navy.mil/photos/images/h96000/h96566kc.htm 2 Debugging Your Program Debugging Your Program. [summary] 1. Edit the program (type in

More information

Programming Language. Control Structures: Selection (switch) Eng. Anis Nazer First Semester

Programming Language. Control Structures: Selection (switch) Eng. Anis Nazer First Semester Programming Language Control Structures: Selection (switch) Eng. Anis Nazer First Semester 2018-2019 Multiple selection choose one of two things if/else choose one from many things multiple selection using

More information

1.1 Your First Program

1.1 Your First Program 1.1 Your First Program Introduction to Programming in Java: An Interdisciplinary Approach Robert Sedgewick and Kevin Wayne Copyright 2002 2010 1/29/11 6:37 AM! Why Programming? Why programming? Need to

More information

Instructor: Eric Rettke Phone: (every few days)

Instructor: Eric Rettke Phone: (every few days) Instructor: Eric Rettke Phone: 818 364-7775 email: rettkeeg@lamission.edu (every few days) Fall 2016 Computer Science 411 - Principles of Cyber Security 1 Please keep a copy of the syllabus handy for the

More information

MTAT Applied Cryptography

MTAT Applied Cryptography MTAT.07.017 Applied Cryptography Introduction, Randomness, One-Time Pad, Stream Ciphers University of Tartu Spring 2015 1 / 33 Who am I? Arnis Paršovs MSc in Cyber Security Tallinn University of Technology,

More information

Introduction to Computer Systems

Introduction to Computer Systems Introduction to Computer Systems Syllabus Web Page http://www.cs.northwestern.edu/~pdinda/icsclass Instructor Peter A. Dinda 1890 Maple Avenue, Room 338 847-467-7859 pdinda@cs.northwestern.edu Office hours:

More information

CS 101 Exam 2 Spring Id Name

CS 101 Exam 2 Spring Id Name CS 101 Exam 2 Spring 2005 Email Id Name This exam is open text book and closed notes. Different questions have different points associated with them. Because your goal is to maximize your number of points,

More information

CS 161: Object Oriented Problem Solving

CS 161: Object Oriented Problem Solving CS160 - Intro CS 161: Object Oriented Problem Solving CS160 was your first programming course Like 160 a combination of programming and discrete math Procedural Java Object Oriented programming Instructor:

More information

COMP-202: Foundations of Programming. Lecture 8: for Loops, Nested Loops and Arrays Jackie Cheung, Winter 2016

COMP-202: Foundations of Programming. Lecture 8: for Loops, Nested Loops and Arrays Jackie Cheung, Winter 2016 COMP-202: Foundations of Programming Lecture 8: for Loops, Nested Loops and Arrays Jackie Cheung, Winter 2016 Review What is the difference between a while loop and an if statement? What is an off-by-one

More information

Other conditional and loop constructs. Fundamentals of Computer Science Keith Vertanen

Other conditional and loop constructs. Fundamentals of Computer Science Keith Vertanen Other conditional and loop constructs Fundamentals of Computer Science Keith Vertanen Overview Current loop constructs: for, while, do-while New loop constructs Get out of loop early: break Skip rest of

More information

Michele Van Dyne Museum 204B CSCI 136: Fundamentals of Computer Science II, Spring

Michele Van Dyne Museum 204B  CSCI 136: Fundamentals of Computer Science II, Spring Michele Van Dyne Museum 204B mvandyne@mtech.edu http://katie.mtech.edu/classes/csci136 CSCI 136: Fundamentals of Computer Science II, Spring 2016 1 Review of Java Basics Data Types Arrays NEW: multidimensional

More information

Introduction Data Structures

Introduction Data Structures Introduction Data Structures This course Lecturer: Nick Smallbone (me) nicsma@chalmers.se, room 5469 Assistant: Alexander Sjösten sjosten@chalmers.se Lectures usually twice a week: Wednesdays 13-15, room

More information

MICROPROCESSORS A (17.383) Fall Lecture Outline

MICROPROCESSORS A (17.383) Fall Lecture Outline MICROPROCESSORS A (17.383) Fall 2010 Lecture Outline Class # 03 September 21, 2010 Dohn Bowden 1 Today s Lecture Syllabus review Microcontroller Hardware and/or Interface Programming/Software Lab Homework

More information

CS 170 Section 3, Spring 2015 Programming in Java Midterm Exam 1. Name (print):

CS 170 Section 3, Spring 2015 Programming in Java Midterm Exam 1. Name (print): Name (print): INSTRUCTIONS: o Keep your eyes on your own paper and do your best to prevent anyone else from seeing your work. o Do NOT communicate with anyone other than the professor/proctor for ANY reason

More information

What did we talk about last time? Public key cryptography A little number theory

What did we talk about last time? Public key cryptography A little number theory Week 4 - Friday What did we talk about last time? Public key cryptography A little number theory If p is prime and a is a positive integer not divisible by p, then: a p 1 1 (mod p) Assume a is positive

More information

8/27/13. An intro to programming* *Java. Announcements. Professor Rodger. The Link. UTAs start TONIGHT!

8/27/13. An intro to programming* *Java. Announcements. Professor Rodger. The Link. UTAs start TONIGHT! An intro to programming* *Java Announcements Professor Rodger The Link UTAs start TONIGHT! 2 1 Announcements Office hours Check the website! 3 Homework Recitation prep due BEFORE recitation on Friday Setup

More information

CS61BL. Lecture 1: Welcome to CS61BL! Intro to Java and OOP Testing Error-handling

CS61BL. Lecture 1: Welcome to CS61BL! Intro to Java and OOP Testing Error-handling CS61BL Lecture 1: Welcome to CS61BL! Intro to Java and OOP Testing Error-handling About me Name: Edwin Liao Email: edliao@berkeley.edu Office hours: Thursday 3pm - 5pm Friday 11am - 1pm 611 Soda Or by

More information

SAMS Programming A/B. Lecture #1 Introductions July 3, Mark Stehlik

SAMS Programming A/B. Lecture #1 Introductions July 3, Mark Stehlik SAMS Programming A/B Lecture #1 Introductions July 3, 2017 Mark Stehlik Outline for Today Overview of Course A Python intro to be continued in lab on Wednesday (group A) and Thursday (group B) 7/3/2017

More information

Public-Service Announcements

Public-Service Announcements Public-Service Announcements The Computer Science Undergraduate Association(CSUA) welcomes all students interested in computer science to join them at their Welcome BBQ on Saturday, 8/27 from 12-4pm at

More information

Making Decisions. Agenda

Making Decisions. Agenda Making Decisions Lecture 5 - B Object-Oriented Programming Agenda Blocks Statements Selection Statement If-else Statement Nested if / if-else Statements Switch Statement Relational Operators Logical Operators

More information

Building Java Programs

Building Java Programs Building Java Programs Chapter 2 Lecture 2-1: Expressions and Variables reading: 2.1-2.2 1 Data and expressions reading: 2.1 self-check: 1-4 videos: Ch. 2 #1 2 Data types type: A category or set of data

More information