General Computer Science for Engineers CISC 106 Lecture 25 Dr. John Cavazos Computer and Information Sciences 04/20/2009.

Slides:



Advertisements
Similar presentations
General Computer Science for Engineers CISC 106 Lecture 21 Dr. John Cavazos Computer and Information Sciences 04/10/2009.
Advertisements

General Computer Science for Engineers CISC 106 Lecture 19 Dr. John Cavazos Computer and Information Sciences 04/06/2009.
General Computer Science for Engineers CISC 106 Lecture 22 Dr. John Cavazos Computer and Information Sciences 04/13/2009.
Lecture 12: Midterm Review Multiple choice quiz from pub website (see web page for link and use access code liang6e614 ) Homework 5: N Queens Sample midterm.
1 ICS102: Introduction To Computing King Fahd University of Petroleum & Minerals College of Computer Science & Engineering Information & Computer Science.
General Computer Science for Engineers CISC 106 Lecture 20 Dr. John Cavazos Computer and Information Sciences 04/08/2009.
General Computer Science for Engineers CISC 106 Final Exam Review Dr. John Cavazos Computer and Information Sciences 05/18/2009.
General Computer Science for Engineers CISC 106 Lecture 31 Dr. John Cavazos Computer and Information Sciences 05/06/2009.
Computer Science 1620 Multi-Dimensional Arrays. we used arrays to store a set of data of the same type e.g. store the assignment grades for a particular.
General Computer Science for Engineers CISC 106 Lecture 08 Dr. John Cavazos Computer and Information Sciences 2/27/2009.
General Computer Science for Engineers CISC 106 Lecture 10 Roger Craig Computer and Information Sciences 3/06/2009.
General Computer Science for Engineers CISC 106 Lecture 12 Roger Craig Computer and Information Sciences 3/11/2009.
General Computer Science for Engineers CISC 106 Lecture 13 Roger Craig Computer and Information Sciences 3/13/2009.
1 11/8/06CS150 Introduction to Computer Science 1 Arrays Chapter 8 page 477 November 13, 2006.
General Computer Science for Engineers CISC 106 Lecture 34 Dr. John Cavazos Computer and Information Sciences 05/13/2009.
General Computer Science for Engineers CISC 106 Lecture 30 Dr. John Cavazos Computer and Information Sciences 05/04/2009.
Topic R3 – Review for the Final Exam. CISC 105 – Review for the Final Exam Exam Date & Time and Exam Format The final exam is 120-minutes, closed- book,
General Computer Science for Engineers CISC 106 Lecture 05 Dr. John Cavazos Computer and Information Sciences 2/20/2009.
General Computer Science for Engineers CISC 106 Lecture 23 Dr. John Cavazos Computer and Information Sciences 4/15/2009.
General Computer Science for Engineers CISC 106 Lecture 26 Dr. John Cavazos Computer and Information Sciences 04/24/2009.
Genome Sciences 373 Genome Informatics Quiz Section 2 April 7, 2015.
General Computer Science for Engineers CISC 106 Lecture 08 James Atlas Computer and Information Sciences 9/21/2009.
General Computer Science for Engineers CISC 106 Lecture 18 Dr. John Cavazos Computer and Information Sciences 3/27/2009.
Recursion.
CS1101: Programming Methodology Aaron Tan.
September 2nd Learning Target: You will be able to graph relations and determine if they are functions are not. You will also be able to identify the domains.
General Computer Science for Engineers CISC 106 Lecture 07 James Atlas Computer and Information Sciences 06/29/2009.
Scott Marino MSMIS Kean University MSAS5104 Programming with Data Structures and Algorithms Week 10 Scott Marino.
REVIEW 2 Exam History of Computers 1. CPU stands for _______________________. a. Counter productive units b. Central processing unit c. Copper.
1 Functions 1 Parameter, 1 Return-Value 1. The problem 2. Recall the layout 3. Create the definition 4. "Flow" of data 5. Testing 6. Projects 1 and 2.
 The pool rack example could be implemented using a for loop.  It is also possible to write recursive methods that accomplish things that you might.
Recursion.  A recursive function contains a call to itself Example: the factorial n!=n*(n-1)! for n>1 n!=1 for n=1 int factorial (int n) { if (n == 0)
Instructor Information: Dr. Radwa El Shawi Room: Week # 1: Overview & Review.
CSC Intro. to Computing Lecture 13: PALGO. Announcements Midterm is in one week  Time to start reviewing  We will do more review in class Tuesday.
DATA STRUCTURES (CS212D) Week # 1: Overview & Review.
I Power Int 2 Computing Software Development High Level Language Constructs.
Vectors and Matrices In MATLAB a vector can be defined as row vector or as a column vector. A vector of length n can be visualized as matrix of size 1xn.
WEEK 4 Class Activities Lecturer’s slides.
Synthesis ENGR 1181 MATLAB 11. Topics  No new material  Covers topics that will be on the Midterm 2 Exam MATLAB 01 – Program Design MATLAB 02 – Introduction.
1 CISC181 Introduction to Computer Science Dr. McCoy Lecture 7 Clicker Questions September 22, 2009.
Lecture 2 Jan Goals: Introduction to recursion Examples of recursive programs Reading: Chapter 1 of the text.
A First Book of ANSI C, Fourth Edition1 Functions for Modularity 04/24/15.
Advanced Computer Science Lesson 4: Reviewing Loops and Arrays Reading User Input.
ENG College of Engineering Engineering Education Innovation Center 1 Array Accessing and Strings in MATLAB Topics Covered: 1.Array addressing. 2.
Math 15 Introduction to Scientific Data Analysis Lecture 9 Python Programming – #3 University of California, Merced.
CSC 107 – Programming For Science. Today’s Goal  Discuss writing functions that return values  return statement’s meaning and how it works  When and.
Computing Science 1P Large Group Tutorial 13 Simon Gay Department of Computing Science University of Glasgow 2006/07.
General Computer Science for Engineers CISC 106 Lecture 13 - Midterm Review James Atlas Computer and Information Sciences 10/02/2009.
Recursion A recursive definition is one which uses the word or concept being defined in the definition itself Example: “A computer is a machine.
April 11, 2005 More about Functions. 1.Is the following a function call or a function header? calcTotal(); 2.Is the following a function call or a function.
General Computer Science for Engineers CISC 106 Lecture 15 Dr. John Cavazos Computer and Information Sciences 03/16/2009.
Lecture 15: Course Review BJ Furman ME 30 16MAY2011.
Lecture 2 What is a computational problem? What is an instance of a problem? What is an algorithm? How to guarantee that an algorithm is correct? What.
General Computer Science for Engineers CISC 106 Lecture 27 Dr. John Cavazos Computer and Information Sciences 04/27/2009.
General Computer Science for Engineers CISC 106 Lecture 09 Dr. John Cavazos Computer and Information Sciences 03/04/2009.
CMSC201 Computer Science I for Majors Lecture 19 – Recursion (Continued) Prof. Katherine Gibson Prof. Jeremy Dixon Based on slides from UPenn’s.
CMSC201 Computer Science I for Majors Lecture 20 – Recursion (Continued) Prof. Katherine Gibson Based on slides from UPenn’s CIS 110, and from previous.
FIGURE 4-10 Function Return Statements
CISC181 Introduction to Computer Science Dr
Topics discussed in this section:
Vectors and Matrices In MATLAB a vector can be defined as row vector or as a column vector. A vector of length n can be visualized as matrix of size 1xn.
Programming Languages
Class 4: Repetition Pretest Posttest Counting Flowchart these!
CS150 Introduction to Computer Science 1
Administrivia- Introduction
Last Class We Covered Recursion Stacks Parts of a recursive function:
CSE 231 Lab 4.
CSCE 206 Lab Structured Programming in C
General Computer Science for Engineers CISC 106 Lecture 15
General Computer Science for Engineers CISC 106 Lecture 11
Presentation transcript:

General Computer Science for Engineers CISC 106 Lecture 25 Dr. John Cavazos Computer and Information Sciences 04/20/2009

Lecture Overview Midterm Review

x = [1 2 3; 4 5 6]; for k = 1:3 for n = 1:2 x(n, k); end What will this print?

x = [1 2 3; 4 5 6; 7 8 9]; Print only 2 nd column (do not use the colon operator)

>> m = [ ]; How do you extract [6 7 8] from the matrix m shown? How do you extract [2 3 4] from the matrix m shown?

Practice Problems Practice problems were uploaded (3 weeks ago). You should know how to do them as we will base some of the midterm on those!

Pop Quiz Get a sheet of paper and do the following problem Will serve as proof of attendance Write a function called sameAsAbove

Pop Quiz (func: sameAsAbove) Pass as input a 2d array (a matrix). Loop through it and print the position and value of every position where the position directly above it has the same value. e.g. [1 2 3; 2 2 3; 4 5 3] would print out EXACTLY: 2,2 and 1,2 = 2 2,3 and 1,3 = 3 3,3 and 2,3 = 3

How do you loop only odd elements in an array? How do you loop through every element that is a multiple of 5 (starting at 5)?

How to test whether variable x is between the values 0 and 5? How do you test whether x is between 5 and 15 or between 30 and 55?

Can a script take in a parameter? Can a function change a variable in your current environment? Can a script return an output? Can you call a script by name?

Study this! Be able to code a recursive function from a recursive definition Review (at least) the following: ◦ Lecture 9 ◦ Lab 4 and Lab 6

expt(base,exponent) = base, if exponent is one base * expt(base,exponent-1) otherwise Write the code that implements the “expt” function.

function num = expt(base,exponent) if (exponent == 1) num = base; else exponent = exponent - 1; num = base * expt(base,exponent); end