CHAPTER 1: INTRODUCTION TO COMPUTER SCIENCE Introduction to Computer Science Using Ruby (c) 2012 Ophir Frieder et al.

Slides:



Advertisements
Similar presentations
CS107: Introduction to Computer Science Lecture 2 Jan 29th.
Advertisements

Component 4: Introduction to Information and Computer Science Unit 5: Overview of Programming Languages, Including Basic Programming Concepts Lecture 1.
PHYS 2020 Pseudocode. Real Programmers Program in Pencil!  You can save a lot of time if you approach programming in a methodical way.  1) Write a clear.
Chapter 2: Problem Solving
By Droids Robotics Good Coding Practices: Start with Pseudocode BEGINNER EV3 PROGRAMMING LESSON © 2015 EV3Lessons.com, Last edit 4/1/
Chapter 2: Algorithm Discovery and Design
Chapter 2: Algorithm Discovery and Design
Algorithm Design CS105. Problem Solving Algorithm: set of unambiguous instructions to solve a problem – Breaking down a problem into a set of sub- problems.
Chapter 16 Programming and Languages: Telling the Computer What to Do.
Chapter 1 Program Design
Lecture Notes 8/30/05 Program Design & Intro to Algorithms.
Chapter 2: Algorithm Discovery and Design
Chapter 2: Algorithm Discovery and Design
Chapter 3 Planning Your Solution
The Fundamentals: Algorithms, the Integers & Matrices.
Documentation 1. User Documentation 2. Technical Documentation 3. Program Documentation.
Introduction to Computers and Programming
Adapted from slides by Marie desJardins
DCT 1123 PROBLEM SOLVING & ALGORITHMS INTRODUCTION TO PROGRAMMING.
6 Steps of the Programming Process
Catie Welsh January 19,  Office Hours ◦ After Class Today ◦ Come if you don’t have Eclipse working 2.
Algorithmic Problem Solving CMSC 201 Adapted from slides by Marie desJardins (Spring 2015 Prof Chang version)
CS161 Topic #21 CS161 Introduction to Computer Science Topic #2.
Chapter 2: Algorithm Discovery and Design Invitation to Computer Science, C++ Version, Third Edition.
Invitation to Computer Science, Java Version, Second Edition.
Chapters 7, 8, & 9 Quiz 3 Review 1. 2 Algorithms Algorithm A set of unambiguous instructions for solving a problem or subproblem in a finite amount of.
Chapter 1 Introduction. Goal to learn about computers and programming to compile and run your first Java program to recognize compile-time and run-time.
CHAPTER 4: CONDITIONAL STRUCTURES Introduction to Computer Science Using Ruby (c) 2012 Ophir Frieder et al.
Introduction Algorithms and Conventions The design and analysis of algorithms is the core subject matter of Computer Science. Given a problem, we want.
Programming for Beginners Martin Nelson Elizabeth FitzGerald Lecture 5: Software Design & Testing; Revision Session.
© 2011 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Stewart Venit ~ Elizabeth Drake Developing a Program.
1 Chapter-01 Introduction to Software Engineering.
Problem Solving using the Science of Computing MSE 2400 EaLiCaRA Spring 2015 Dr. Tom Way.
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.
Branches and Program Design
1 Chapter-01 Introduction to Software Engineering.
CS221 Algorithm Basics. What is an algorithm? An algorithm is a list of instructions that transform input information into a desired output. Each instruction.
Introduction to Programming in VB Chapter 1. 2 Software Development Life Cycle Gather Requirements Design Program Code & Test Program Implement u Software.
The Art of Programming. The process of breaking problems down into smaller, manageable parts By breaking the problem down, each part becomes more specific.
How to Program? -- Part 1 Part 1: Problem Solving –Analyze a problem –Decide what steps need to be taken to solve it. –Take into consideration any special.
How Are Computers Programmed? CPS120: Introduction to Computer Science Lecture 5.
Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 14 Do It, Then Ask Permission.
INVITATION TO Computer Science 1 11 Chapter 2 The Algorithmic Foundations of Computer Science.
WHAT IS THIS? Clue…it’s a drink SIMPLE SEQUENCE CONTROL STRUCTURE Introduction A computer is an extremely powerful, fast machine. In less than a second,
1 Chapter-01 Introduction to Software Engineering.
Programming. In your own words, explain what an algorithm is, and give an example of how people use algorithms every day.
Chapter 2: Algorithm Discovery and Design Invitation to Computer Science.
Problem Solving.  Similar to Solving Math Word Problem  Read the Problem  Decide how to go about Solving the Problem  Solve the Problem  Test the.
Introduction to Problem Solving Programming is a problem solving activity. When you write a program, you are actually writing an instruction for the computer.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 1 An Introduction to Visual Basic.NET and Program Design.
Low-Level Programming Languages, Pseudocode and Testing Chapter 6.
Topic: Programming Languages and their Evolution + Intro to Scratch
How do the students earn points on the essay?
Algorithm and Ambiguity
Transition to Code Upsorn Praphamontripong CS 1110
Algorithm and Ambiguity
An Introduction to Visual Basic .NET and Program Design
BEGINNER PROGRAMMING LESSON
Introduction to Algorithms
BEGINNER PROGRAMMING LESSON
Chapter 1 Introduction(1.1)
Programming We have seen various examples of programming languages
CHAPTER 8: USING OBJECTS
BEGINNER PROGRAMMING LESSON
CHAPTER 4: Conditional Structures
Computer Science The 6 Programming Steps.
Basic Concepts of Algorithm
Unit 2: Computational Thinking, Algorithms & Programming
WJEC GCSE Computer Science
CMPT 120 Lecture 2 - Introduction to Computing Science – Problem Solving, Algorithm and Programming.
Presentation transcript:

CHAPTER 1: INTRODUCTION TO COMPUTER SCIENCE Introduction to Computer Science Using Ruby (c) 2012 Ophir Frieder et al

What is Computer Science?  The study of algorithm design and implementation  Algorithm: the description of the steps required to solve a problem  The steps are expressed by instructions to the computer (c) 2012 Ophir Frieder et al

What is Computer Science?  Computer program: the sequence of all the instructions needed for the algorithms  Programming language: the tool to specify the computer program  Examples: Ruby, C, C++, Python, Java (c) 2012 Ophir Frieder et al

What is Computer Science?  The study of algorithms helps to create solutions that yield correct results in a timely manner How do I get to Ruby Lane? Directions 1.Go straight. 2.Take right. 3.Take second right. Directions 1.Go straight. 2.Take right. 3.Take second right. Ruby Lane Problem:Algorithm:Solution: (c) 2012 Ophir Frieder et al

Application Development  Computers follow instructions, so all details must be specified.  Example: “Spread peanut butter on one slice of bread, and jelly on another slice of bread. Then put the slices of bread together.” This is enough information for a human to make a peanut butter-jelly sandwich, but not enough information for a computer. (c) 2012 Ophir Frieder et al

A Basic Approach to Problem Solving  Step 1: Understand the problem  Step 2: Write out the problem in plain language  Step 3: Translate the plain language into programming language  Step 4: Test the code in the computer (c) 2012 Ophir Frieder et al

Step 1: Understand the Problem  Try to answer all the questions about the problem  Look for the goals, data available, and results to be derived  Example: A program that stores a list of names  How many names will be stored?  Do first and last names need to be stored separately?  Are middle names needed?  What is the maximum length that a name can be? (c) 2012 Ophir Frieder et al

Step 2: Write out the Problem in English  Determine the steps necessary to go from data to results  Make an outline of the solution  Example: A program that stores a list of names 1. Ask for the first name. 2. Store the first name. 3. Ask for the last name. 4. Store the last name. 5. Ask for the middle initial. 6. Store the middle initial. (c) 2012 Ophir Frieder et al

Step 3: Translate the English into Programming Language  Write the specification based on the English version  Include comments  Non-executable documentation aimed to help the user  Example: A program that stores a list of names 1 puts "Enter first name: ” # Ask for the first name 2 first_name = gets # Store the first name 3 puts "Enter last name: ” # Ask for the last name 4 last_name = gets # Store the last name 5 puts "Enter middle initial: ” # Ask for middle initial 6 middle_initial = gets # Store the middle initial (c) 2012 Ophir Frieder et al

Step 4: Test the Code in the Computer  See if the code runs properly  Test the code in sections as your write (c) 2012 Ophir Frieder et al

Algorithms  Step-by-step methods for solving problems  Describe the process, but not each and every minutia  Example Algorithm for Directions: 1. Start going South on River Road. 2. Turn left (East) on Main Street. 3. Take a right (South) on Ruby Lane. 4. Turn left (East) toward Algorithm Circle. 5. Continue until you come to 345 Algorithm Circle. (c) 2012 Ophir Frieder et al

Example Algorithm for Directions (Figure 1.2) (c) 2012 Ophir Frieder et al

Algorithms  Efficient algorithms reduce the number of steps needed  Improved Algorithm for Directions: 1. Start going South on River Road. 2. Turn lest (East) one block South of Main Street on to Algorithm Circle. 3. Continue until you come to 345 Algorithm Circle. (c) 2012 Ophir Frieder et al

Improved Algorithm for Directions (Figure 1.3) (c) 2012 Ophir Frieder et al

Summary  Computer science uses algorithms to solve problems  The computer needs every detail to solve the problem  Efficiency should be considered  Step 1: Understand the problem.  Step 2: Write out a plain language (or another pseudo-code) solution.  Step 3: Translate the plain language or pseudo-code into code.  Step 4: Test the code in the computer. Algorithms: step-by-step methods for solving problems Basic Steps for Computer Science Programs: (c) 2012 Ophir Frieder et al