1 CS 106, Winter 2009 Class 19, Section 4 Slides by: Dr. Cynthia A. Brown, Instructor section 4: Dr. Herbert G. Mayer,

Slides:



Advertisements
Similar presentations
Programming with Alice Computing Institute for K-12 Teachers Summer 2011 Workshop.
Advertisements

Chapter 10 Introduction to Arrays
Recursion. Recursion is a powerful technique for thinking about a process It can be used to simulate a loop, or for many other kinds of applications In.
Arrays. What is an Array? An array is a way to structure multiple pieces of data of the same type and have them readily available for multiple operations.
1 CS 106, Winter 2009 Class 3, Section 4 Slides by: Dr. Cynthia A. Brown, Instructor section 4: Dr. Herbert G. Mayer,
Debugging Techniques1. 2 Introduction Bugs How to debug Using of debugger provided by the IDE Exception Handling Techniques.
11 CS 106, Winter 2009 Class 20, Section 4 Slides by: Dr. Cynthia A. Brown, Instructor section 4: Dr. Herbert G. Mayer,
1 CS 106, Winter 2009 Class 14, Section 4 Slides by: Dr. Cynthia A. Brown, Instructor section 4: Dr. Herbert G. Mayer,
1 CS 106, Winter 2009 Class 1, Section 4 Slides by: Dr. Cynthia A. Brown, Instructor section 4: Dr. Herbert G. Mayer,
1 CS 106, Winter 2009 Class 10, Section 4 Slides by: Dr. Cynthia A. Brown, Instructor section 4: Dr. Herbert G. Mayer,
1 CS 106, Winter 2009 Class 11, Section 4 Slides by: Dr. Cynthia A. Brown, Instructor section 4: Dr. Herbert G. Mayer,
1 CS 106, Winter 2009 Class 5, Section 4 Slides by: Dr. Cynthia A. Brown, Instructor section 4: Dr. Herbert G. Mayer,
1 CS 106, Winter 2009 Class 8, Section 4 Slides by: Dr. Cynthia A. Brown, Instructor section 4: Dr. Herbert G. Mayer,
1 CS 106, Winter 2009 Class 2, Section 4 Slides by: Dr. Cynthia A. Brown, Instructor section 4: Dr. Herbert G. Mayer,
1 CS 106, Winter 2009 Class 4, Section 4 Slides by: Dr. Cynthia A. Brown, Instructor section 4: Dr. Herbert G. Mayer,
1 CS 106, Winter 2009 Class 17, Section 4 Slides by: Dr. Cynthia A. Brown, Instructor section 4: Dr. Herbert G. Mayer,
General Computer Science for Engineers CISC 106 Lecture 21 Dr. John Cavazos Computer and Information Sciences 04/10/2009.
Case, Arrays, and Structures. Summary Slide  Case Structure –Select Case - Numeric Value Example 1 –Select Case - String Value Example  Arrays –Declaring.
Arrays  Writing a program that uses a large amount of information.  Such as a list of 100 elements.  It is not practical to declare.
Wednesday, 12/11/02, Slide #1 CS 106 Intro to Comp. Sci. 1 Wednesday, 12/11/02  QUESTIONS??  Today: CLOSING CEREMONIES!  HW #5 – Back Monday (12/16)
1 CS100J 14 March 2006 Arrays. Reading: Secs 8.1, 8.2, 8.3. Listen to the following lectures on loops on your Plive CD. They are only 2-3 minutes long,
Lec6 P 1 CP2030 Visual Basic For C++ programmers Copyright © University of Wolverhampton CP2030 VBFC Lecture 6 Back To Index v Procedures and Parameters.
ECE122 L11: For loops and Arrays March 8, 2007 ECE 122 Engineering Problem Solving with Java Lecture 11 For Loops and Arrays.
PSU CS 106 Computing Fundamentals II VB Subprograms & Functions HM 4/29/2008.
Chapter 9 Introduction to Arrays
2015 Pre-Release Practice Click the button to try a random exam-style question. Click on the reveal button to check your answer.
Java Unit 9: Arrays Declaring and Processing Arrays.
1 CS 106 Computing Fundamentals II Chapter 25 “Variables, Assignment Statement” Herbert G. Mayer, PSU CS Status 7/4/2013 Initial content copied verbatim.
PROGRAMMING IN VISUAL BASIC.NET VISUAL BASIC BUILDING BLOCKS Bilal Munir Mughal 1 Chapter-5.
Chapter 12 Recursion, Complexity, and Searching and Sorting
MAT Meyer Week 2 Programming VB: ‘basics’ Review & preview: Events, variables, statements, etc. Images, Control arrays, For/Next Assignment: read.
224 3/30/98 CSE 143 Recursion [Sections 6.1, ]
Arrays Tonga Institute of Higher Education. Introduction An array is a data structure Definitions  Cell/Element – A box in which you can enter a piece.
Arrays and 2D Arrays.  A Variable Array stores a set of variables that each have the same name and are all of the same type.  Member/Element – variable.
19/10/20151 Data Structures Arrays. 219/10/2015 Learning Objectives Explain initialising arrays and reading data into arrays. Design and write routine/s.
Arrays Module 6. Objectives Nature and purpose of an array Using arrays in Java programs Methods with array parameter Methods that return an array Array.
Objectives - 11  We will work with processing Arrays.  Objectives:  Describe the concept of an array and its benefits.  Define the terms index, traverse,
1 Compiler Construction (CS-636) Muhammad Bilal Bashir UIIT, Rawalpindi.
1 Κατανεμημένες Διαδικτυακές Εφαρμογές Πολυμέσων Γιάννης Πετράκης.
CS 330 Programming Languages 10 / 07 / 2008 Instructor: Michael Eckmann.
Programming in Java Dr. M. Ahmadzadeh. Course Outline (subject to tiny changes) I will cover the following but not necessarily in this order. –Strings.
1 Working with Data Structures Kashef Mughal. 2 Chapter 5  Please review on your own  A few terms .NET Framework - programming model  CLR (Common.
Programming Logic and Design Fourth Edition, Comprehensive Chapter 8 Arrays.
1 CS 106 Computing Fundamentals II Chapter 75 “Arrays” Herbert G. Mayer, PSU CS Status 7/31/2013 Initial content copied verbatim from CS 106 material developed.
1 CS105 Discussion 5 – Variables and If Announcements MP 1 due on Monday Midterm 1 on Tuesday If you need a conflict, request it NOW!!
CSE 232: C++ memory management Overview of Arrays Arrays are the simplest kind of data structure –One item right after another in memory (“contiguous range”
Hints on debugging
Arrays and others. Annoucement Today’s office hour move to Friday 1:00PM to 3:00PM Today’s office hour move to Friday 1:00PM to 3:00PM Today Today  Call.
1 CS 106 Computing Fundamentals II Chapter 79 “Recursion” Herbert G. Mayer, PSU CS status 6/24/2013 Initial content copied verbatim from CS 106 material.
Recursion A recursive definition is one which uses the word or concept being defined in the definition itself Example: “A computer is a machine.
CS12230 Introduction to Programming Lecture 6-2 –Errors and Exceptions 1.
Multiple Items in one Data Object Arrays are a way to store more than one piece of data in a data object, provided that all the data is of the same type.
Ranges. Unlike many of our programming concepts, the idea of a Range is particular to Excel The ideas and code discussed in these slides can be found.
A High Flying Overview CS139 – Fall 2006 How far we have come.
AVCE ICT – Unit 7 - Programming Session 12 - Debugging.
Recursion in Java The answer to life’s greatest mysteries are on the last slide.
Arrays and Loops. Learning Objectives By the end of this lecture, you should be able to: – Understand what a loop is – Appreciate the need for loops and.
Today… Python Keywords. Iteration (or “Loops”!) Winter 2016CISC101 - Prof. McLeod1.
Quiz 3 Topics Functions – using and writing. Lists: –operators used with lists. –keywords used with lists. –BIF’s used with lists. –list methods. Loops.
A High Flying Overview CS139 – Fall 2010 How far we have come.
Function Recursion to understand recursion you must understand recursion.
CS139 – Fall 2010 How far we have come
CISC101 Reminders Quiz 1 grading underway Assn 1 due Today, 9pm.
CS 106 Computing Fundamentals II Chapter 71 “Indexing”
CS 106 Computing Fundamentals II Chapter 73 “Ranges”
CS 106 Computing Fundamentals II Chapter 66 “Working With Strings”
Learning VB2005 language (basics)
Programming Control Structures with JavaScript Part 2
CISC101 Reminders All assignments are now posted.
Recursion (part 1) October 25, 2006 ComS 207: Programming I (in Java)
Presentation transcript:

1 CS 106, Winter 2009 Class 19, Section 4 Slides by: Dr. Cynthia A. Brown, Instructor section 4: Dr. Herbert G. Mayer,

2 IMPORTANT!! The final exam for Section 2 (MW eve) is at 7:30 pm. Sorry for the earlier error, and thanks to the student who pointed it out! The loop in Assignment 6 can start at 5 instead of 1.

3 Arrays Arrays are a way to structure multiple pieces of data of the same type In this way they resemble Excel columns You can perform operations on an array in an efficient way using loops.

4 VB Arrays In VB arrays are declared much like variables: Dim name As String Dim nameArray(20) As String This creates an array of 21 elements, numbered from 0 to 20 We want to start indexing at 1, so we will just ignore the 0 th element, and make our arrays have the number of elements we want, plus one

5 Things to watch out for with arrays You must be careful not to try to put more items in the array than it will hold (overflow). Doing so should cause a runtime error but may instead just result in mysterious bugs. You should not try to index beyond the end of an array. This should also cause a runtime error, but might just result in getting a strange answer back.

6 Array Demos The array demos show examples of reading data into an array from a file, and then performing various operations on it Note that the file should be in the debug folder of the bin folder inside the project (in case you want to play around with files)

7 BREAK 10 minutes

8 Recursion Recursion is a powerful technique for thinking about a process It can be used to simulate a loop, or for many other kinds of applications In recursion, a function or procedure calls itself Obviously, there is a danger of an infinite recursion, so there has to be a test for stopping it, and something (usually a parameter) must change between calls