TA SURVEY Have the TA write their name on the board Fill out the survey at: https://www.surveymonkey.com/s/TAOS_Fall2013 The TA should walk out 5 minutes.

Slides:



Advertisements
Similar presentations
Finding Multiplication Combinations and Factors using arrays
Advertisements

Lab III – Linux at UMBC.
The Writing Process Communication Arts.
CHAPTER 2 ALGORITHM ANALYSIS 【 Definition 】 An algorithm is a finite set of instructions that, if followed, accomplishes a particular task. In addition,
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.
 By carefully incrementing the X and/or Y values of our set of lines, we can create a game board for a boat game.  Lines that go from left to right are.
Introduction to Computing Science and Programming I
Conditionals Lab Dan Maselko. Overview  Gain familiarity with working with conditionals  Become familiar with using the modulus operator  Understand.
Mock test review Revision of Activity Diagrams for Loops,
CS 106 Introduction to Computer Science I 10 / 09 / 2006 Instructor: Michael Eckmann.
Please open your laptops, log in to the MyMathLab course web site, and open Daily Quiz 16. IMPORTANT NOTE: If you have time left out of your five minutes.
EASY TEAM MANAGER By Dave Abineri EASYWARE: PO Box 231, Milford, OHIO (Cincinnati) Phone: (513) Use UP arrow to move to the NEXT slide Use.
Adding Content To Your Faculty Page 1.Login 2.Create your Faculty Page 3.
Lesson 6C – Loops 3 – Advanced File Processing By John B. Owen All rights reserved ©2011.
Iteration. Adding CDs to Vic Stack In many of the programs you write, you would like to have a CD on the stack before the program runs. To do this, you.
Lab 8 Basic Design and Documentation. Learn about top-down design and how to document your code properly. Look at a design diagram to figure out how to.
Simulation Walk Through See how your learners might use a simulation on your course.
Understanding the TigerSHARC ALU pipeline Determining the speed of one stage of IIR filter – Part 3 Understanding the memory pipeline issues.
By Chad Blankenbeker.  The for-loop is best used when you know how many times it is going to be looped  So if you know you want it to only loop 10 times,
CS101 Computer Programming I Chapter 4 Extra Examples.
Loops Wrap Up 10/21/13. Topics *Sentinel Loops *Nested Loops *Random Numbers.
1 FUNCTIONS - I Chapter 5 Functions help us write more complex programs.
1 Flight Times. 2 Problem Specification 3 Additional Specifications You may assume that the input is a valid 24 hour time. Output the time entered by.
Copyright © Curt Hill Loop Types and Construction Logical types and construction hints.
HKOI Programming HKOI Training Team (Intermediate) Alan, Tam Siu Lung Unu, Tse Chi Yung.
CIS Intro to JAVA Lecture Notes Set July-05 GUI Programming –TextField Action Listeners, JEditorPane action listeners, HTML in a JEditorPane,
Solving 2-Step Variable Equations What??? I just learned 1-step! Relax. You’ll use what you already know to solve 2-step equations.
1 Project 2: Using Variables and Expressions. 222 Project 2 Overview For this project you will work with three programs Circle Paint Ideal_Weight What.
How do I multiply a triple digit number by a double digit? 145 x 67 = ? 267 x 19 = ? I’m sure that you’ll agree that there are many methods that we can.
Confidential1 Multiplying Decimals. Confidential2 WARM UP – = = – = Is it true?
Searching CSE 103 Lecture 20 Wednesday, October 16, 2002 prepared by Doug Hogan.
1 UMBC CMSC 104, Section Fall 2002 Functions, Part 1 of 3 Topics Top-down Design The Function Concept Using Predefined Functions Programmer-Defined.
Clue Paths. Memory Alias Review Remember that it’s possible for two unique variables to point to the same memory location myList MyClass mc 0x100 someFn.
1 Functions Function Prototype float sqrt(float x); Function name, type, parameter and parameter type Function Definition float sqrt(float x) { // compute.
Graphics Lab: MyPaint Dan Maselko 1. MyPaint Description  For this assignment you will be implementing a very simple paint program.  You should be able.
CMSC 104, Section 301, Fall Lecture 18, 11/11/02 Functions, Part 1 of 3 Topics Using Predefined Functions Programmer-Defined Functions Using Input.
Today… Modularity, or Writing Functions. Winter 2016CISC101 - Prof. McLeod1.
Loops Brent M. Dingle Texas A&M University Chapter 6 – Section 6.3 Multiway Branches (and some from Mastering Turbo Pascal 5.5, 3 rd Edition by Tom Swan)
Warm-Up If you do not have a math notebook yet, you can do these problems on any piece of paper. You need a math notebook by Monday! 1)Order from least.
CMSC201 Computer Science I for Majors Lecture 05 – Comparison Operators and Boolean (Logical) Operators Prof. Katherine Gibson Prof. Jeremy.
CMSC201 Computer Science I for Majors Lecture 19 – Recursion
MULTIPLICATION 5 Multiplicand X 3 Multiplier 15 Product LET’S LEARN
Interior Angle Measure Lesson and Questions
While multiplying larger numbers involves more steps, it’s not necessarily more challenging. If you know the steps to organize the process. So, what strategies.
Multiply using the Distributive Property
Overview of Spreadsheets
CS1010 Discussion Group 11 Week 11 – Recursion recursion recursion….
Solving EQUATIONS Lesson #2 created by: ms. Guarnieri
Using a Stack Chapter 6 introduces the stack data type.
CMIS 102 Competitive Success-- snaptutorial.com
CMIS 102 Education for Service-- snaptutorial.com
CMIS 102 Teaching Effectively-- snaptutorial.com
LO To assess my understanding of transformations
Addition Grids.
Graph Paper Programming
Graph Paper Programming
Using a Stack Chapter 6 introduces the stack data type.
Activator New Seating Chart
CMSC201 Computer Science I for Majors Lecture 19 – Recursion
CMSC 314 Prof. Lupoli.
UMBC CMSC 104 – Section 01, Fall 2016
CSCE 314 Prof. Lupoli.
Using a Stack Chapter 6 introduces the stack data type.
Using a Stack Chapter 6 introduces the stack data type.
Functions continued.
IPC144 Introduction to Programming Using C Week 4 – Lesson 2
CSCE 315 Prof. Lupoli.
Lecture 20 – Practice Exercises 4
Module 4 Loops and Repetition 9/19/2019 CSE 1321 Module 4.
Presentation transcript:

TA SURVEY Have the TA write their name on the board Fill out the survey at: The TA should walk out 5 minutes MAX  Still have a lot to do today!!

CMSC 201 MR. LUPOLI Problem Solving

Steps to Solve a Problem Read the problem completely many times. Solve the problem manually with a few sets of sample data. (or smaller pieces!!) Optimize the manual steps. Write the manual steps as comments or pseudo- code. Add to the comments or pseudo-code with real code. Optimize the real code.

Read the problem. Do not assume anything! Make sure to view the demonstration as well (if given) Instructions  Create directory lab12  Move to that directory and copy a file already created for you. cp /afs/umbc.edu/users/s/l/slupoli/pub/labCode201/lab12.py.

Reading the Problem Visit: Read the problem In lab12.py  Describe the project you are about to start in the file header “description”

Reading the Problem Under your description of the project, within comments, list your questions ''' 1. When is this project due? 2. Will the grid always be 20 x 20? 3. Will each number be an integer? '''

Reading the Problem Why am I typing this inside the file?  Used a Comment  Can copy and paste to an to my TA/instructor  Can add the answer later  A reminder

Using sample data Can we downsize the problem slightly  Usually we can, now more manageable  Make sure it has valid data and really tests your application  A new matrix of all 1’s is useless!!! We will make a 5 x 5 matrix instead Grab some paper and draw this test matrix out!!  Can still manually solve  What would the largest value be for HORIZONTAL and VERTICAL?

Using sample Data In main, a 5 by 5 matrix named “twoD” has been created for you!!  Fill the rest of the matrix with values (not done for you) # setup twoD = [0] * ROWS for i in range(ROWS): twoD[i] = [0] * COLS # enter 25 values individually twoD[0][0] = 4

Solve the problem Let’s break it down first Easy one first  Multiply horizontally  twoD[0][0] * twoD[0][1] * twoD[0][2] * twoD[0][3]  Store value  Compare with maximum value so far  Then twoD[0][1] * twoD[0][2] * twoD[0][3] * twoD[0][4]  Store value  Compare with maximum value so far  … (in a loop)

Solving the problem In thinking it out, what do we have to watch out for??  Initializing a MAX value  Out of bounds  Comparison of the recently multiplied to the CURRENT MAX  Storing the NEW max value

Solving the Problem In your lab12.py  The function “multiplyHorizontal()” has been started  Will accept the matrix  Function will return the MAX value it determined  FYI - You will create multiplyVertical() AFTER you are successful with multiplyHorizontal()

Write the manual steps as comments Inside your new function  Comment on how you are going to solve it, step by step  Remember, you will need a nested loop, since we are dealing with a matrix  Similar to this: for i in range(ROWS-??): for j in range(COLS-??): answer = …

Add code to the comments Begin coding AFTER NEXT slide!!  On your own!! When you think you are done with THAT function  Call the function from main(), while passing your test function # test matrix here maxHorizontal = multiplyHorizontal(twoD) print(maxHorizontal) Make sure your result is correct Move onto multiplyVertical( )

What to show your TA Questions about the project inside lab12.py Drawn test matrix Coded  TEST matrix  COMPLETED multiplyHorizontal function  COMPLETED multiplyVertical function Running Code  PRINTED AND CORRECT value from multiplyHorizontal and multiplyVertical function