CompSci 101 Introduction to Computer Science January 19, 2016 Prof. Rodger compsci 101 spring 20161.

Slides:



Advertisements
Similar presentations
CompSci 101 Introduction to Computer Science January 22, 2015 Prof. Rodger compsci101 spring151.
Advertisements

Chapter 1 - An Introduction to Computers and Problem Solving
C Programming for engineers Teaching assistant: Ben Sandbank Home page:
How does Google search for everything? Searching For and Organizing Data Prof. Susan Rodger Computer Science Dept Duke University Oct. 31, 2014.
Lecturer: Fintan Costello Welcome to Hdip 001 Introduction to Programming.
Class 1: What this course is about. Assignments Reading: Chapter 1, pp 1-33 Do in Class 1: –Exercises on pages 13, 14, 22, 28 To hand in in Class 2: –Exercises.
Chapter 3 Planning Your Solution
Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington Java Programs COMP 102 #3.
Introduction to High-Level Language Programming
Compsci 101, Spring COMPSCI 101, Spring 2012 Introduction to Computer Science Owen Astrachan
CompSci 101 Introduction to Computer Science January 13, 2015 Prof. Rodger compsci 101 spring
WEEK 1 CS 361: ADVANCED DATA STRUCTURES AND ALGORITHMS Dong Si Dept. of Computer Science 1.
Ch 1. Introduction Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2012.
CSE 1340 Introduction to Computing Concepts Class 2.
Introduction CSE 1310 – Introduction to Computers and Programming
Abstraction IS 101Y/CMSC 101 Computational Thinking and Design Tuesday, September 17, 2013 Carolyn Seaman University of Maryland, Baltimore County.
COMP Introduction to Programming Yi Hong May 13, 2015.
Computer science Kieran elder. What is computer science What is binary Binary maths What is hexadecimal Hexadecimal numbers programs for programming Different.
Introduction CSE 1310 – Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington 1.
CS 106 Introduction to Computer Science I 01 / 25 / 2010 Instructor: Michael Eckmann.
Compsci 06/101, Fall COMPSCI 06/101, Fall 2010 Owen Astrachan Robert Duvall
Instructor: Tina Tian. About me Office: RLC 203A Office Hours: Wednesday 1:30 - 4:30 PM or .
Media Computing Instructor Byung Kim Olsen 231 Office hours – MWF 9:00-10:00 AM or by appointment.
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
Chapter 1 What is Programming? Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition) by S.N. Kamin, D. Mickunas, E.
Introduction CSE 1310 – Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington 1.
CompSci Topics since midterm l Java  Methods  Sound  Graphics l Software design  Recursion  Arrays  Copyright issues l Computer systems.
Abstraction IS 101Y/CMSC 101 Computational Thinking and Design Tuesday, September 17, 2013 Marie desJardins University of Maryland, Baltimore County.
Computer Programming TCP1224 Chapter 3 Completing the Problem-Solving Process and Getting Started with C++
The Beauty and Joy of Computing Lecture #3 : Creativity & Abstraction UC Berkeley EECS Lecturer Gerald Friedland.
CSCI 51 Introduction to Computer Science Dr. Joshua Stough January 20, 2009.
Compsci 101.2, Fall Plan For the Day l Discuss Algorithms and Programming at a high level, examples with cooperative/group work  Connect to reading.
How to Read Code Benfeard Williams 6/11/2015 Susie’s lecture notes are in the presenter’s notes, below the slides Disclaimer: Susie may have made errors.
CompSci CompSci 6 Programming Design and Analysis I Dietolf (Dee) Ramm
CompSci 101 Introduction to Computer Science Sept. 9, 2014 Prof. Rodger President Brodhead speech graduation 2010 CompSci 101 Fall
C++ and Ubuntu Linux Review and Practice CS 244 Brent M. Dingle, Ph.D. Game Design and Development Program Department of Mathematics, Statistics, and.
CPS 100, Spring Tools: Solve Computational Problems l Algorithmic techniques  Brute-force/exhaustive, greedy algorithms, dynamic programming,
CPS Topics since last test l Recursion l Sound l Graphics l Software design  Object-oriented  Copyright issues l Computer systems  Hardware 
Software Design 14.1 CPS 108 l Object oriented design and programming of medium-sized projects in groups using modern tools and practices in meaningful.
Introduction to Python Lesson 1 First Program. Learning Outcomes In this lesson the student will: 1.Learn some important facts about PC’s 2.Learn how.
CPS What is Computer Science? What is it that distinguishes it from the separate subjects with which it is related? What is the linking thread.
CS 106 Introduction to Computer Science I 01 / 22 / 2007 Instructor: Michael Eckmann.
Introduction CSE 1310 – Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington 1.
Computer Science Reaching Wider Summer School 2012.
Dr. Sajib Datta CSE Spring 2016 INTERMEDIATE PROGRAMMING.
Data Structures and Algorithms in Java AlaaEddin 2012.
CompSci 101 Introduction to Computer Science January 28, 2016 Prof. Rodger compsci101 spring161.
Compsci 101.2, Fall Plan for October l Structuring Data and Code for Efficiency  Computer time, how expensive is it?  Data storage, how.
Dr. Sajib Datta Jan 15,  Instructor: Sajib Datta ◦ Office Location: ERB 336 ◦ Address: ◦ Web Site:
CompSci 101 Introduction to Computer Science January 26, 2016 Prof. Rodger compsci 101, spring
© Peter Andreae Java Programs COMP 102 # T1 Peter Andreae Computer Science Victoria University of Wellington.
CompSci 101 Introduction to Computer Science January 15, 2015 Prof. Rodger 1.
Phase 3: Game Creation. Phase 3: Game Creation Outcomes (Slide 1) I can create a flowchart to solve a problem, for example to make a cup of tea. I can.
CompSci 101 Introduction to Computer Science Sept 13, 2016 Prof. Rodger compsci101 fall161.
CompSci 101 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
CompSci 6 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
Introduction CSE 1310 – Introduction to Computers and Programming
CompSci 101 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
Prof. Susan Rodger Computer Science Dept Duke University Oct. 31, 2014
CSE1320 INTERMEDIATE PROGRAMMING
Presentation transcript:

CompSci 101 Introduction to Computer Science January 19, 2016 Prof. Rodger compsci 101 spring 20161

Announcements Reading for next time on calendar page –RQ 2 due Thursday Assignment 1 out today –Have fun with Blockly Install your environment Lab 1 this week! Plan for Today: –Problem Solving and Python compsci 101 spring 20162

Review Scratch program "Hello World" Scratch Program Colors –Duke blue: motion –Mustard: control –Light blue: sensing –Orange: data –Purple: looks compsci 101 spring 20163

Python code hello.py compsci 101 spring 20164

Python data reading code f = open("kjv10.txt") st = f.read() total = len(st) zc = st.count('z') print "total # chars = ",total print "number of z’s",zc for ch in 'aeiou': print ch, st.count(ch) compsci 101 spring 20165

Explaining Python code? compsci 101 spring 20166

Duke Connection: Fred Brooks '53 What Would FB Say? "The most important single decision I ever made was to change the IBM 360 series from a 6-bit byte to an 8-bit byte, thereby enabling the use of lowercase letters. That change propagated everywhere." "Fred Brooks" by Copyright owned by SD&M ( - Request for picture sent by to Fred Brooks by uploader (Mark Pellegrini; user:Raul654) Fred sent this photo back, along with contact information for Carola Lauber at SD&M, who gave copyright permission.. Licensed under CC BY-SA 3.0 via Wikimedia Commons compsci 101 spring 20167

Why is programming fun? Fred Brooks First is the sheer joy of making things Second is the pleasure of making things that are useful Third is the fascination of fashioning complex puzzle-like objects of interlocking moving parts Fourth is the joy of always learning Finally, there is the delight of working in such a tractable medium. The programmer, like the poet, works only slightly removed from pure thought-stuff. compsci 101 spring 20168

Lab 1 This Week Install Before attending if can Modify Python program Scratch program 9

Our Programming Environment Install 5 items Why Java? – not using Eclipse – platform for development Python – programming language Pydev – Python IDE for Eclipse Ambient – turnin/snarf files to/from Duke compsci 101 spring

How does one get help in CompSci 101? Consulting hours –Sunday-Thursday 7-11pm Office hours (prof, TAs) Collaborate with other students Piazza –Ask questions –Do not post your code and ask what is wrong! –Post error message and line of code for error message –If added class late, may need to add yourself 11

How to succeed in Compsci 101 Start assignments early, they'll take longer than you think they will Read the book, but we'll cover the material in class, so … Collaborate well, but be sure you can do work on your own! Be curious, work hard at beginning, think carefully compsci 101 spring

Algorithm Recipe Sequence of steps that constitute instructions Step-by-step procedure for calculations What does Nate Silver do? How do Netflix and Amazon know me? Compsci101 project: capable of implementation as a program, but much more basic compsci 101 spring

Google “algorithm” compsci 101 spring

Developing an Algorithm $193, $540, $820, $700, $749. Are these reasonable? Why? compsci 101 spring

I'm thinking of a number … You guess. I'll tell you high, low, or correct –Goal: guess quickly, minimal number of guesses –Number between 1 and 100… –Number between 1 and 1000… Can you describe an algorithm, instructions, that would allow someone to use your instructions to play this game correctly. Start with 1 and 100, but ideally your instructions work with 1 and N compsci 101 spring

Analyzing the binary search algorithm Is the algorithm correct? –Try it, again, and again and … –Reason about it: logically, informally, … How efficient is the algorithm? –How many guesses will it take (roughly, exactly) –Should we care about efficiency? When do we really care about efficiency? –Examples? compsci 101 spring

1.Anderson 2.Applegate 3.Bethune 4.Brooks 5.Carter 6.Douglas 7.Edwards 8.Franklin 9.Griffin 10.Holhouser 11.Jefferson 12.Klatchy 13.Morgan 14.Munson 15.Narten 16.Oliver 17.Parker 18.Rivers 19.Roberts 20.Stevenson 21.Thomas 22.Wilson 23.Woodrow 24.Yarbrow Find Narten FOUND! compsci 101 spring

Looking for a Needle in a Haystack If a computer can examine 10 million names/numbers a second, suppose the list isn't sorted, or I say "yes/no", not "high/low" –How long to search a list of 10 million? –How long to search a list of a billion? –14 billion pixels in a 2 hour blu-ray movie What about using binary search? How many guesses for 1000, 10 6, 10 9, –One of the things to remember: 2 10 =

Algorithms that scale: another example Human Genome Project –Multiple approaches, relying heavily on computational power and algorithms –Combine reads of DNA sequences, we'll look at an illustrative example These combine bio/chemistry techniques with computational techniques to recreate the sequencing, e.g., CGATTCCG… from "live data", actual DNA. compsci 101 spring

Eugene (Gene) Myers Lead computer scientist/software engineer at Celera Genomics, then at Berkeley, now at Janelia Farms Research Institute (HHMI) "What really astounds me is the architecture of life. The system is extremely complex. It's like it was designed." … " There's a huge intelligence there.” BLAST and WG-Shotgun

Whole Genome Shotgun with words Creation algorithm –Take a phrase –Replicate it four times –Chop into "chunks" characters How to recreate original phrase? olve problems. ratively, create, compsci101 we get t 01 we get to work colla vely, create, and s. In compsci1 y, create, and s e get to work collabo … compsci 101 spring

From Algorithms to Code An algorithm that scales needs to run on a computer --- programming to the rescue! Extensive libraries help with programming –Brain or Neuroscience –Engineering and Mathematics –Genomics –Graphic User Interfaces, … We are using Python, extensible and simple compsci 101 spring

Understanding terminology: code Move from "Hello World" to "Hello Around the World" –Look at Python, code, libraries –Learning (reviewing) terminology about Python print "hello world" f = open("hello.txt") for line in f: print line compsci 101 spring

Hello around world code compsci 101 spring

Running and Understanding Code Need Python compiler/interpreter –We're using Canopy, includes libraries Need an editor development environment –We use Eclipse and PyDev, open source and widely used, Ambient is Duke Plugin You need experience thinking and coding and debugging ideas and code: –Installing the suite of tools can be cumbersome Persist, Perservere, Get Help, start over  compsci 101 spring