CSci 107 Introduction to Computer Science Lecture 1.

Slides:



Advertisements
Similar presentations
CS107 Introduction to Computer Science Lecture 3, 4 An Introduction to Algorithms: Loops.
Advertisements

CS107 Introduction to Computer Science Lecture 2.
CS107: Introduction to Computer Science Lecture 2 Jan 29th.
LeongHW, SoC, NUS (UIT2201: Algorithms) Page 1 Algorithms  Readings: [SG] Ch. 2 & 3  Chapter Outline: 1.Chapter Goals 2.What are Algorithms 1.Real Life.
Computer Science 101 Survey of Computer Science What is computer science?
* Programming is the activity of creating a set of detailed instructions (program) that when carried out on a consistent set of inputs will result in.
CMSC 104, Version 8/061L04Algorithms1.ppt Algorithms, Part 1 of 3 Topics Definition of an Algorithm Algorithm Examples Syntax versus Semantics Reading.
CS1010 Programming Methodology
Computer Science 101 Overview of Algorithms. Example: Make Pancakes Prepare batter Beat 2 eggs Add 1 tablespoon of brown sugar Add 1 cup of milk Add 2.
Csci 107 Introduction to Computer Science. Administrativia See class webpage for –Office hours –Grading policy –Syllabus –Lab assignments –Readings.
CS 1400 Course Reader Introduction. What is Programming? Designing an appropriate algorithm Coding that algorithm in a computer language.
CMPUT101 Introduction to Computing(c) Yngvi Bjornsson & Jia You1 Algorithm Discovery and Design Chapter 2 Topics: Representing Algorithms Algorithmic Problem.
Computer Software & Software Development H&K Chapter 1 Instructor – Gokcen Cilingir Cpt S 121 (June 20, 2011) Washington State University.
CS107 Introduction to Computer Science Lecture 1 Introduction.
Chapter 1: An Introduction to Computer Science Invitation to Computer Science, C++ Version, Third Edition.
CS107 Introduction to Computer Science Loops. Instructions Pseudocode Assign values to variables using basic arithmetic operations x = 3 y = x/10 z =
CS107 Introduction to Computer Science
CMPUT101 Introduction to Computing(c) Yngvi Bjornsson1 An Introduction to Computer Science Chapter 1 Topics: The Definition of Computer Science Algorithms.
CSci 107 Introduction to Computer Science Lecture 1.
Chapter 2: Algorithm Discovery and Design
CS107 Introduction to Computer Science Lecture 2.
CHAPTER 2 CS
Genome Sciences 373 Genome Informatics Quiz Section #1 March 31, 2015.
Chapter 2: Algorithm Discovery and Design
Programming. Software is made by programmers Computers need all kinds of software, from operating systems to applications People learn how to tell the.
COMPUTER SCIENCE 10: INTRODUCTION TO COMPUTER SCIENCE Dr. Natalie Linnell with credit to Cay Horstmann and Marty Stepp.
1 Chapter 1 Basic Computer Concept 國立雲林科技大學 資訊工程研究所 張傳育 (Chuan-Yu Chang ) 博士 Office: EB 212 TEL: ext. 4337
Introduction Dr. Ying Lu RAIK 283: Data Structures & Algorithms.
DCT 1123 PROBLEM SOLVING & ALGORITHMS INTRODUCTION TO PROGRAMMING.
Introduction to Programming (in C++) Conclusions Jordi Cortadella, Ricard Gavaldà, Fernando Orejas Dept. of Computer Science, UPC.
Chapter 2: Algorithm Discovery and Design Invitation to Computer Science, C++ Version, Third Edition.
Invitation to Computer Science, Java Version, Second Edition.
Computer Science 10: Introduction to Computer Science Dr. Natalie Linnell with credit to Cay Horstmann and Marty Stepp.
Introduction Algorithms and Conventions The design and analysis of algorithms is the core subject matter of Computer Science. Given a problem, we want.
The Algorithmic Model. What is Computer Science What is Programming Algorithms –Definition –Properties of Good Algorithms –Describing Algorithms –Examples.
CSE 102 Introduction to Computer Engineering What is an Algorithm?
Programming for Beginners Martin Nelson Elizabeth FitzGerald Lecture 5: Software Design & Testing; Revision Session.
Introduction to Algorithms. What is Computer Science? Computer Science is the study of computers (??) This leaves aside the theoretical work in CS, which.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 5: Algorithms Computer Science: An Overview Tenth Edition by J. Glenn.
CMSC 1041 Algorithms I An Introduction to Algorithms.
Algorithms, Part 1 of 3 Topics  Definition of an Algorithm  Algorithm Examples  Syntax versus Semantics Reading  Sections
Procedural Programming. Programming Process 1.Understand the problem 2.Outline a general solution 3.Decompose the general solution into manageable component.
CMSC 1041 Algorithms I An Introduction to Algorithms.
Computer Science 101 Introduction.
Dale Roberts Department of Computer and Information Science, School of Science, IUPUI CSCI 230 Models of Computation Dale Roberts, Lecturer Computer Science,
1 UMBC CMSC 104, Section Fall 2002 Algorithms, Part 1 of 3 Topics Definition of an Algorithm Algorithm Examples Syntax versus Semantics Reading.
Quiz1 Question  Add Binary Numbers a) b) c) d) e) none
Low-Level Programming Languages, Pseudocode and Testing Chapter 6.
CMSC 104, L041 Algorithms, Part 1 of 3 Topics Definition of an Algorithm Example: The Euclidean Algorithm Syntax versus Semantics Reading Sections 3.1.
Algorithms, Part 1 of 3 The First step in the programming process
Algorithms, Part 1 of 3 Topics Definition of an Algorithm
Introduction to Algorithms
Algorithms I: An Introduction to Algorithms
Algorithm and Ambiguity
2008/09/24: Lecture 6b CMSC 104, Section 0101 John Y. Park
2008/09/17: Lecture 4 CMSC 104, Section 0101 John Y. Park
CSci 107 Introduction to Computer Science
Algorithm Discovery and Design
UMBC CMSC 104 – Section 01, Fall 2016
Algorithm Discovery and Design
Introduction to Algorithms and Programming
Programming We have seen various examples of programming languages
Programming.
Algorithm and Ambiguity
Algorithms, Part 1 of 3 Topics Definition of an Algorithm
Discovery and Design of Algorithms
Algorithms vs. Programming
Computer Science 101 Survey of Computer Science
Algorithms, Part 1 of 3 Topics Definition of an Algorithm
Algorithms vs. Programming
Presentation transcript:

CSci 107 Introduction to Computer Science Lecture 1

Resources Class webpage 05/ –Office hours –Grading policy –Syllabus –Lab assignments –Readings

Csci 107 This class is a broad introduction to CS. The goal is to find out what CS is about and find out about its applications and impact in other disciplines. Step-by-step introduction into the art of problem solving using computers Assumes no previous knowledge on computers and programming. Intended for majors and non-majors

Csci 107 Goal: learn to think like a computer scientist Why??? –Computers are everywhere.. –IT fastest growing industry, largest number of jobs so what? Can’t I be a successful Biologist, Physisist, Chemist, teacher, therapist, geologist, environmentalist, … …without computer science? –Yes… if you are 70. –Probably, if you are 18. But knowledge of computers will make you much more effective in any career you may choose.

What is Computer Science? Computer Science is the study of computers (??) This leaves aside the theoretical work in CS, which does not make use of real computers, but of formal models of computers A lot of work in CS is done with pen and paper! Actually, the early work in CS took place before the development of the first computer Computer Science is no more about computers than astronomy is about telescopes, biology is about microscopes, or chemistry is about test tubes. Science is not about tools. It is about how we use them, and what we find out we can do.

What is Computer Science? Computer Science is the study of how to write computer programs (programming) (??) Programming is a big part of CS....but it is not the most important part. Computer Science is the study of the uses and applications of computers and software (??) Learning to use software packages is no more a part of CS than driver’s education is part of automotive engineering. CS is responsible for building and designing software.

What is an algorithm? … a well-defined procedure that allows an agent to solve a problem. Note: often the agent is a computer or a robot… Example algorithms Cooking a dish Making a peanut-butter jelly sandwich Shampooing hair Programming a VCR Making a pie

Example Is this an algorithm? Step 1: Wet hair Step 2: Lather Step 3: Rinse Step 4: Repeat Would you manage to wash your hair with this algorithm? How about a robot? Why (not)?

Algorithms An algorithm must: 1. Be well-ordered and unambiguous 2. Each operation must be effectively executable 3. Terminate.

Algorithm for Programming a VCR Step 1: If the clock and calendar are not correctly set, then go to page 9 of the instructionmanual and follow the instructions before proceeding Step 2: Place a blank tape into the VCR tape slot Step 3: Repeat steps 4 through 7 for each program that you wish to record, up to a maximum of 10 shows Step 4: Enter the channel number that you wish to record, and press the button labeled CHAN Step 5: Enter the start time and press TIME-START Step 6: Enter the end time and press END-TIME Step 7: This completes the programming of one show. If you do not wish to program anything else press END-PROG Step 8: Press te button labeles TIMER. Your VCR is ready to record.

Types of Operations Basic operations –Wet hair –Rinse –Turn on VCR Conditional operations –If batter is too dry add water Repeat/looping operations –Repeat step 1 and 2 three times –Repeat steps 2,3,4,…10 until batter becomes soft.

Algorithm How to come up with an algorithm? –Problem solving How to represent an algorithm? –In English?? –In a programming language??

Example Problem: Given two positive integers, compute their greatest common divisor Euclid’s algorithm: –Step 1: Get two positive integer values from the user –Step 2: Assign M and N the value of the larger and smaller of the two input values, respectively –Step 3: Divide M by N, and call the remainder R –Step 4: If R is not 0, then assign M the value of N, assign te value of R, and return to step 2; otherwise, the greatest common divisor is the value currently assigned to N

Coming up with algorithms.. How do people think???? Puzzle: –Before A, B, C and D ran a race they made the following predictions: A predicted that B would win B predicted that D would be last C predicted that A would be third D predicted that A’s prediction would be correct. –Only one of these predictions was true, and this was the prediction made by the winner. In what order did A, B, C, D finish the race?

Example Problem: Adding two n-digit numbers How would you write an algorithm to solve this problem? Assume the basic operation is adding one-digit numbers.

Expressing algorithms Is natural language good? –For daily life, yes…but for CS is lacks structure and would be hard to follow –Too rich, ambiguous, depends on context How about a programming language? –Good, but not when we try to solve a problem..we want to think at an abstract level –It shifts the emphasis from how to solve the problem to tedious details of syntax and grammar.

Pseudocode Pseudocode = English but looks like programming Good compromise –Simple, readable, no rules, don’t worry about punctuation. –Lets you think at an abstract level about the problem. –Contains only instructions that have a well-defined structure and resemble programming languages