The Beauty and Joy of Computing

Similar documents
01 INTRODUCTION TO COURSE

The Beauty and Joy of Computing

The Beauty and Joy of Computing Quest (first exam) in in 16 days!! Lecture #3 : Functions

Lecture #3: Recursion

Getting to places from my house...

Algorithms. Definition. Algorithms we've seen... Part 1: The Basics

Lecture #3: Recursion


The Beauty & Joy of Computing

Pseudocode Structure 5th October 2018

CISC 1100: Structures of Computer Science

What is an algorithm? CISC 1100/1400 Structures of Comp. Sci./Discrete Structures Chapter 8 Algorithms. Applications of algorithms

CS3: Introduction to Symbolic Programming. Lecture 14: Lists.

CIS* Programming

The Beauty and Joy of Computing

The Beauty and Joy of Computing

Department of Electrical Engineering and Computer Sciences Spring 2001 Instructor: Dan Garcia CS 3 Midterm #2. Personal Information

Loops. In Example 1, we have a Person class, that counts the number of Person objects constructed.

Preface A Brief History Pilot Test Results

Chapter 2. Database Design. Database Systems p. 25/540

WELCOME! (download slides and.py files and follow along!) LECTURE 1

COP 1220 Introduction to Programming in C++ Course Justification

CS102 Unit 2. Sets and Mathematical Formalism Programming Languages and Simple Program Execution

Computing and Programming

Computing and Programming. Notes for CSC The Beauty and Joy of Computing The University of North Carolina at Greensboro

378: Machine Organization and Assembly Language

SOEE1160: Computers and Programming in Geosciences Semester /08. Dr. Sebastian Rost

COMP-202 Unit 8: Recursion. CONTENTS: Recursion in Java More complex examples

Extended Introduction to Computer Science CS1001.py Lecture 10, part A: Interim Summary; Testing; Coding Style

Review for the Final Exam CS 8: Introduction to Computer Science, Winter 2018 Lecture #15

COMP-202: Foundations of Programming. Lecture 13: Recursion Sandeep Manjanna, Summer 2015

Definitions. Lecture Objectives. Text Technologies for Data Science INFR Learn about main concepts in IR 9/19/2017. Instructor: Walid Magdy

Intensive Introduction to Computer Science. Course Overview Programming in Scratch

CS61A Lecture 28 Distributed Computing. Jom Magrotker UC Berkeley EECS August 6, 2012

On-Page SEO is the foundation with which backlinks and other off-page SEO strategies reach their highest potential.

Introduction to Data Structures

Programming for Engineers in Python

Warmup. A programmer s wife tells him, Would you mind going to the store and picking up a loaf of bread? Also, if they have eggs, get a dozen.

How do students do in a C++ based CS2 course, if the CS1 course is taught in Python? Short answer: no different than those who took CS1 with C++.

CS 132 Exam #1 - Study Suggestions

CSE 114, Computer Science 1 Course Information. Spring 2017 Stony Brook University Instructor: Dr. Paul Fodor

CS10 : The Beauty and Joy of Computing

Virtual University of Pakistan

CS383 PROGRAMMING LANGUAGES. Kenny Q. Zhu Dept. of Computer Science Shanghai Jiao Tong University

CS3: Introduction to Symbolic Programming. Lecture 14: Lists Scheme vs. other programming languages.

CONTENTS: What Is Programming? How a Computer Works Programming Languages Java Basics. COMP-202 Unit 1: Introduction

CS 4100 // artificial intelligence

Unit 6 - Software Design and Development LESSON 3 KEY FEATURES

CS112 Lecture: Loops

CS2013 Course Syllabus Spring 2018 Lecture: Mon/Wed 2:00 P.M. 2:50 P.M. SH C259 Lab: Mon/Wed 2:50 P.M. 4:00 P.M. SH C259

Lecture #2: Programming Structures: Loops and Functions

Lecture 3, Review of Algorithms. What is Algorithm?

Lecture 5 - Control Structure Applications

CS/ENGRD 2110 Object-Oriented Programming and Data Structures Spring 2012 Thorsten Joachims

Textbook(s) and other required material: Raghu Ramakrishnan & Johannes Gehrke, Database Management Systems, Third edition, McGraw Hill, 2003.

DATABASE SYSTEMS. Chapter 5 Entity Relationship (ER) Modelling DESIGN IMPLEMENTATION AND MANAGEMENT INTERNATIONAL EDITION ROB CORONEL CROCKETT

During the first 2 weeks of class, all students in the course will take an in-lab programming exam. This is the Exam in Programming Proficiency.

Warmup. A programmer s roommate tells him, Would you mind going to the store and picking up a loaf of bread. Also, if they have eggs, get a dozen.

Information Technology Fundamentals. Unit 1: Computer Basics Wrap-up

Warmup. A programmer s roommate tells him, Would you mind going to the store and picking up a loaf of bread. Also, if they have eggs, get a dozen.

Python & Web Mining. Lecture Old Dominion University. Department of Computer Science CS 495 Fall 2012

Case-Based Reasoning. CS 188: Artificial Intelligence Fall Nearest-Neighbor Classification. Parametric / Non-parametric.

CS 188: Artificial Intelligence Fall 2008

Unit 6 - Software Design and Development LESSON 3 KEY FEATURES

EECS 395 Programming Languages

Visual Programming (CBVP2103) This course is worth 3 credit hours Will be covered in weeks Total 13 topics Assessment

Welcome to CS120 Fall 2012

Course: Honors AP Computer Science Instructor: Mr. Jason A. Townsend

EECS 321 Programming Languages

1. Answer as shown or -1 unless question allows partial credit. No points off for minor differences in spacing, capitalization, commas, and braces.

CS 206 Introduction to Computer Science II

! Learn how to think like a computer scientist. ! Learn problem solving. ! Read and write code. ! Understand object oriented programming

CS39N The Beauty and Joy of Computing

61A Lecture 7. Monday, September 15

Computing and Programming

CS10 The Beauty and Joy of Computing

The Beauty and Joy of Computing

ITT Technical Institute. ET2560T Introduction to C Programming Onsite and Online Course SYLLABUS

Chapter 8 Algorithms 1

Software Project. Lecturers: Ran Caneti, Gideon Dror Teaching assistants: Nathan Manor, Ben Riva

COLLEGE OF THE DESERT

ITE 205 Software Design and Programming I

This Time. What can IT provide INFO 2. What ICT can provide? What ICT can provide?

Solving Your Problem by Generalization

745: Advanced Database Systems

2. COURSE DESIGNATION: 3. COURSE DESCRIPTIONS:

COMPUTER SCIENCE/INFORMATION SYSTEMS DEGREE PLAN

CONTENTS: What Is Programming? How a Computer Works Programming Languages Java Basics. COMP-202 Unit 1: Introduction

CS10 The Beauty and Joy of Computing

CSE200 Lecture 6: RECURSION

CS 1110, LAB 12: SEQUENCE ALGORITHMS First Name: Last Name: NetID:

Announcements. Last modified: Thu Nov 29 16:15: CS61B: Lecture #40 1

Computer Programming. Basic Control Flow - Loops. Adapted from C++ for Everyone and Big C++ by Cay Horstmann, John Wiley & Sons

Slide 1 CS 170 Java Programming 1 Arrays and Loops Duration: 00:01:27 Advance mode: Auto

Application of Dynamic Programming to Calculate Denominations Used in Changes Effectively

Optimization Problems and Wrap-Up. CS 221 Lecture 14 Tue 6 December 2011

CS 190C: Introduction to Computational Thinking

#101 Page: 1 Name: CS32 Midterm Exam. E01, W15, Phill Conrad, UC Santa Barbara

CS2013 Course Syllabus Spring 2017 Lecture: Friday 8:00 A.M. 9:40 A.M. Lab: Friday 9:40 A.M. 12:00 Noon

Fundamentals of Operations Research. Prof. G. Srinivasan. Department of Management Studies. Indian Institute of Technology, Madras. Lecture No.

Transcription:

The Beauty and Joy of Computing UC Berkeley EECS Lecturer Gerald Lecture #6 Algorithms I Quest (first exam) in in 2 days!!

What is an algorithm? An algorithm is any well-defined computational procedure that takes some value or set of values as input and produces some value or set of values as output. The concept of algorithms, however, is far older than computers. UC Berkeley The Beauty and Joy of Computing : Algorithms I (2)

Early Algorithms Dances, ceremonies, recipes, and building instructions are all conceptually similar to algorithms. Babylonians defined some fundamental mathematical procedures ~3,600 years ago. Genes contain algorithms! Photo credit: Daniel Niles UC Berkeley The Beauty and Joy of Computing : Algorithms I (3)

Algorithms You've Seen in CS10 Length of word Whether a word appears in a list Interact with the user (ask) Word Comparisons (You wrote one for HW1!) Sort a List (see lab!) Make this a block! UC Berkeley The Beauty and Joy of Computing : Algorithms I (4)

Algorithms You Might Have Heard Of Luhn algorithm Credit card number validation Deflate Lossless data compression PageRank Google s way of measuring reputation of web pages EdgeRank Facebook s method for determining what is highest up on your news feed UC Berkeley The Beauty and Joy of Computing : Algorithms I (5)

Important Terms Sequencing Application of each step of an algorithm in order (sometimes: find order) Iteration Repetition of part of an algorithm until a condition is met Selection Use of Boolean condition to select execution parst Recursion Repeated application of the same part of algorithm on smaller problems UC Berkeley The Beauty and Joy of Computing : Algorithms I (6)

Properties of Algorithms Algorithm + Algorithm = Algorithm Part of Algorithm = Algorithm Algorithms can be efficient or inefficient given a comparison algorithm Several algorithms may solve the same problem UC Berkeley The Beauty and Joy of Computing : Algorithms I (7)

Algorithm Correctness We don't only want algorithms to be fast and efficient; we also want them to be correct! TOTAL Correctness Always reports, and the answer is always correct. PARTIAL Correctness Sometimes reports, and the answer is always correct when it reports. We also have probabilistic algorithms that have a certain probability of returning the right answer. UC Berkeley The Beauty and Joy of Computing : Algorithms I (8)

How to Express Algorithms A programmer s spouse tells him: Run to the store and pick up a loaf of bread. If they have eggs, get a dozen. The programmer comes home with 12 loaves of bread. Algorithms need to be expressed in a contextfree, unambiguous way for all participants UC Berkeley The Beauty and Joy of Computing : Algorithms I (9)

Ways to Express Algorithms Natural Language Pseudo Code Programming Language or in any other information conveying way! UC Berkeley The Beauty and Joy of Computing : Algorithms I (10)

Programming Languages C/C++ Good for programming that is close to hardware Java/C# Portable code Python/Perl/TclTK Fast to write and portable BASIC/BYOB/SNAP Good for teaching programming concepts All programming languages can be used to implement (almost) any algorithm! UC Berkeley The Beauty and Joy of Computing : Algorithms I (11)

Choosing a Technique Most problems can be solved in more than one way, i.e., multiple algorithms exist to describe how to find the solution. The right language makes formulating algorithms easier and clearer Not all of these algorithms are created equal. Very often we have to make some trade-offs when we select a particular one. There are unsolvable problems! UC Berkeley The Beauty and Joy of Computing : Algorithms I (12)

Algorithms vs. Functions & Procedures Algorithms are conceptual definitions of how to accomplish a task and are language agnostic, usually written in pseudo-code. Find max value in list A function or procedure is an implementation of an algorithm, in a particular language. Find max value in list Set (a temporary variable) the max as the first element Go through every element, compare to max, and if it s bigger, replace the max Return the max UC Berkeley The Beauty and Joy of Computing : Algorithms I (13)

Summary The concept of an algorithm has been around forever, and is an integral topic in CS. Algorithms are welldefined procedures that can take inputs and produce output. Programming languages help us express them. We're constantly dealing with trade-offs when selecting / building algorithms. Correctness is particularly important and testing is the most practical strategy to ensure it. Many write tests first! UC Berkeley The Beauty and Joy of Computing : Algorithms I (14)