Arrays. Array Data Type. Array - Memory Layout. Array Terminology. Gaddis: 7.1-3,5

Size: px
Start display at page:

Download "Arrays. Array Data Type. Array - Memory Layout. Array Terminology. Gaddis: 7.1-3,5"

Transcription

1 Arrays Unit 5 Gaddis: 7.1-3,5 CS 1428 Spring 2018 Ji Seaman Array Data Type Array: a variabe that contains mutipe vaues of the same type. Vaues are stored consecutivey in memory. An array variabe decaration statement in C++: int numbers[5]; This creates an array caed numbers which contains 5 integer vaues (ints). 1 2 Array - Memory Layout The definition: int numbers[5]; aocates the foowing memory: (vaues are stored consecutivey in memory) first eement second eement third eement fourth eement fifth eement Array Terminoogy Given the foowing array definition: int numbers[5]; numbers is the name of the array int is the data type of the array eements 5 is the size decarator: the number of eements (vaues) in the array. 3 4

2 Size Decarator 7.2 Accessing Array Eements The size decarator must be an integer and a constant. it must be greater than 0 IT CANNOT BE A VARIABLE!* It can be a itera or a named constant. const int SIZE = 40; doube grades[size]; Named constants ease program maintenance when the size of the array must be changed. *Uness you are using a specia compier (mine is not specia). 5 Each eement of the array has a unique subscript (or index) that indicates its position in the array. The subscripts are 0-based the first eement has subscript 0 the second eement has subscript 1... the ast eement has subscript (size -1) the ast eement s subscript is n-1 where n is the number of eements in the array 6 Accessing Array Eements Given this array decaration: int numbers[5]; The syntax to access one eement is: numbers[2] //the third eement of numbers array Pronounced numbers at 2 or numbers sub 2 Array subscripts The subscript is ALWAYS an integer regardess of the type of the array eements. the subscript can be ANY integer expression itera: 2 numbers[2] variabe: i numbers[i] expression: (i+2)/2 numbers[(i+2)/2] 7 8

3 Inputting array contents Most array operations must be done one eement at a time. Input programming assignment grades for a student in CS1428: << programming assignment scores: << end; cin >> scores[0]; cin >> scores[1]; cin >> scores[2]; cin >> scores[3]; cin >> scores[4]; cin >> scores[5]; cin >> scores[6]; Is there a better way? 9 Array input using a oop We can use a for oop to input into the array The subscript/index can be the oop variabe: << programming assignment scores: << end; i starts at 0, the first vaid subscript oop ends when i is 7, the first invaid subscript This code is equivaent to the code on the 10 previous side. Array output using a oop We can aso use a for oop to output the eements of the array: << programming assignment scores: << end; cout << You entered these vaues: ; cout << scores[i] << ; cout << end; 11 Array initiaization You can initiaize arrays when they are defined. const int NUM_SCORES = 3; foat scores[num_scores] = {86.5, 92.1, 77.5; Vaues are assigned in order: scores[0] = 86.5 scores[1] = 92.1 scores[2] = NOTE: uninitiaized arrays have GARBAGE vaues stored in them (not necessariy 0). 12

4 Partia Array Initiaization When you initiaize, you don t need to specify a vaue for every position. foat scores[7] = {86.5, 92.1, 77.5; Impicit array sizing When you initiaize, you don t need to specify the size decarator. foat scores[] = {86.5, 92.1, 77.5; In this case, the first 3 eements are initiaized to the specified vaues. The uninitiaized vaues WILL be set to 0!!!! In this case, the compier determines the size of the array from the number of eements isted C++: No bounds checking C++ does not check it to make sure an array subscript is vaid (between 0 and size-1) If you use a subscript that is outside the bounds of the array you may not get a warning or error. You may unintentionay change memory aocated to other variabes. const int SIZE = 3; int vaues[size]; for (int i=0; i < 5; i++) { vaues[i] = 100; This code defines a threeeement array and then writes five vaues to it (changing the memory after the array) Processing Array Contents Given the foowing array definition: doube tests[10]; the expression tests[i] may be used exacty ike any variabe of type doube. tests[0] = 79; cout << tests[0]; cin >> tests[1]; tests[4] = tests[0] + tests[1]; 16

5 Using array eements: doube vaues[3]; //array definition vaues[0] = 22.3; //assignment to array eement vaues[1] = 11.1; cout << Enter a number: ; cin >> vaues[2]; doube sum = vaues[0] + vaues[1] + vaues[2]; doube avg = sum/3.0; cout << Vaues at zero: << vaues[0] << end; int i=2; if (vaues[i] > 32.0) cout << Above freezing << end; 17 Operations over Entire Arrays Generay there are NO operations that you can perform over an entire array. Some operations may appear to work (no errors) but you don t get the desired resuts. int numbers1[] = {1, 2, 3; int numbers2[] = {4, 5, 6; cin >> numbers1; //input, won t work cout << numbers1 << end; //output, won t work numbers1 = numbers2; //assignment, won t work if (numbers1==numbers2) //comparison, won t work... numbers3 = numbers1 + numbers2; //addition, won t work 18 Summing vaues in an array We can use a for oop to sum the eements of the array (the running tota) << programming assignment scores: << end; int tota = 0; //initiaize accumuator tota = tota + scores[i]; How do you get the average programming assignment score? 19 Finding the maximum vaue in an array We can use a for oop to find the max vaue: Note: keep track of the maximum vaue encountered so far (the running maximum) << programming assignment scores: << end; int maximum = scores[0]; //init max to first eem for (int i=1; i < NUM_SCORES; i++) { //start i at 1 if (scores[i] > maximum) maximum = scores[i]; //save the new maximum 20 // no ese needed

6 Array assignment To copy/assign one array to another, you must assign eement by eement. const int SIZE = 4; int vaues1[size] = {100, 200, 300, 400; int vaues2[size]; // vaues2 = vaues1; WRONG, won t work correcty for (int i = 0; i < SIZE; i++) { vaues2[i] = vaues1[i]; Note: this aso does not work: vaues2 = {3,6,9,27; //ony works for initiaization 21

Arrays. Array Data Type. Array - Memory Layout. Array Terminology. Gaddis: 7.1-4,6

Arrays. Array Data Type. Array - Memory Layout. Array Terminology. Gaddis: 7.1-4,6 Arrays Unit 5 Gaddis: 7.1-4,6 CS 1428 Fa 2017 Ji Seaman Array Data Type Array: a variabe that contains mutipe vaues of the same type. Vaues are stored consecutivey in memory. An array variabe definition

More information

Functions. 6.1 Modular Programming. 6.2 Defining and Calling Functions. Gaddis: 6.1-5,7-10,13,15-16 and 7.7

Functions. 6.1 Modular Programming. 6.2 Defining and Calling Functions. Gaddis: 6.1-5,7-10,13,15-16 and 7.7 Functions Unit 6 Gaddis: 6.1-5,7-10,13,15-16 and 7.7 CS 1428 Spring 2018 Ji Seaman 6.1 Moduar Programming Moduar programming: breaking a program up into smaer, manageabe components (modues) Function: a

More information

Structures. Data Types Structures. Data Types (C/C++) Gaddis: A Data Type consists of: Unit 7. example: Integer. CS 1428 Spring 2018

Structures. Data Types Structures. Data Types (C/C++) Gaddis: A Data Type consists of: Unit 7. example: Integer. CS 1428 Spring 2018 Structures Data Types A Data Type consists of: Unit 7 Gaddis: 11.2-8 set of vaues set of operations over those vaues CS 1428 Spring 2018 Ji Seaman exampe: Integer whoe numbers, -32768 to 32767 +, -, *,

More information

Week 4. Pointers and Addresses. Dereferencing and initializing. Pointers as Function Parameters. Pointers & Structs. Gaddis: Chapters 9, 11

Week 4. Pointers and Addresses. Dereferencing and initializing. Pointers as Function Parameters. Pointers & Structs. Gaddis: Chapters 9, 11 Week 4 Pointers & Structs Gaddis: Chapters 9, 11 CS 5301 Spring 2017 Ji Seaman 1 Pointers and Addresses The address operator (&) returns the address of a variabe. int x; cout

More information

Intro to Programming & C Why Program? 1.2 Computer Systems: Hardware and Software. Why Learn to Program?

Intro to Programming & C Why Program? 1.2 Computer Systems: Hardware and Software. Why Learn to Program? Intro to Programming & C++ Unit 1 Sections 1.1-3 and 2.1-10, 2.12-13, 2.15-17 CS 1428 Spring 2018 Ji Seaman 1.1 Why Program? Computer programmabe machine designed to foow instructions Program a set of

More information

Straight-line code (or IPO: Input-Process-Output) If/else & switch. Relational Expressions. Decisions. Sections 4.1-6, , 4.

Straight-line code (or IPO: Input-Process-Output) If/else & switch. Relational Expressions. Decisions. Sections 4.1-6, , 4. If/ese & switch Unit 3 Sections 4.1-6, 4.8-12, 4.14-15 CS 1428 Spring 2018 Ji Seaman Straight-ine code (or IPO: Input-Process-Output) So far a of our programs have foowed this basic format: Input some

More information

Intro to Programming & C Why Program? 1.2 Computer Systems: Hardware and Software. Hardware Components Illustrated

Intro to Programming & C Why Program? 1.2 Computer Systems: Hardware and Software. Hardware Components Illustrated Intro to Programming & C++ Unit 1 Sections 1.1-3 and 2.1-10, 2.12-13, 2.15-17 CS 1428 Fa 2017 Ji Seaman 1.1 Why Program? Computer programmabe machine designed to foow instructions Program instructions

More information

3.1 The cin Object. Expressions & I/O. Console Input. Example program using cin. Unit 2. Sections 2.14, , 5.1, CS 1428 Spring 2018

3.1 The cin Object. Expressions & I/O. Console Input. Example program using cin. Unit 2. Sections 2.14, , 5.1, CS 1428 Spring 2018 Expressions & I/O Unit 2 Sections 2.14, 3.1-10, 5.1, 5.11 CS 1428 Spring 2018 Ji Seaman 1 3.1 The cin Object cin: short for consoe input a stream object: represents the contents of the screen that are

More information

l A program is a set of instructions that the l It must be translated l Variable: portion of memory that stores a value char

l A program is a set of instructions that the l It must be translated l Variable: portion of memory that stores a value char Week 1 Operators, Data Types & I/O Gaddis: Chapters 1, 2, 3 CS 5301 Fa 2018 Ji Seaman Programming A program is a set of instructions that the computer foows to perform a task It must be transated from

More information

l A set is a collection of objects of the same l {6,9,11,-5} and {11,9,6,-5} are equivalent. l There is no first element, and no successor of 9.

l A set is a collection of objects of the same l {6,9,11,-5} and {11,9,6,-5} are equivalent. l There is no first element, and no successor of 9. Sets & Hash Tabes Week 13 Weiss: chapter 20 CS 5301 Spring 2018 What are sets? A set is a coection of objects of the same type that has the foowing two properties: - there are no dupicates in the coection

More information

Professor: Alvin Chao

Professor: Alvin Chao Professor: Avin Chao CS149 For Each and Reference Arrays Looping Over the Contents of an Array We often use a for oop to access each eement in an array: for (int i = 0; i < names.ength; i++) { System.out.printn("Heo

More information

l Tree: set of nodes and directed edges l Parent: source node of directed edge l Child: terminal node of directed edge

l Tree: set of nodes and directed edges l Parent: source node of directed edge l Child: terminal node of directed edge Trees & Heaps Week 12 Gaddis: 20 Weiss: 21.1-3 CS 5301 Fa 2016 Ji Seaman 1 Tree: non-recursive definition Tree: set of nodes and directed edges - root: one node is distinguished as the root - Every node

More information

Solutions to the Final Exam

Solutions to the Final Exam CS/Math 24: Intro to Discrete Math 5//2 Instructor: Dieter van Mekebeek Soutions to the Fina Exam Probem Let D be the set of a peope. From the definition of R we see that (x, y) R if and ony if x is a

More information

Week 3. Function Definitions. Example: Function. Function Call, Return Statement. Functions & Arrays. Gaddis: Chapters 6 and 7. CS 5301 Spring 2018

Week 3. Function Definitions. Example: Function. Function Call, Return Statement. Functions & Arrays. Gaddis: Chapters 6 and 7. CS 5301 Spring 2018 Week 3 Functions & Arrays Gaddis: Chapters 6 and 7 CS 5301 Spring 2018 Jill Seaman 1 Function Definitions l Function definition pattern: datatype identifier (parameter1, parameter2,...) { statements...

More information

Introduction to the Stack. Stacks and Queues. Stack Operations. Stack illustrated. elements of the same type. Week 9. Gaddis: Chapter 18

Introduction to the Stack. Stacks and Queues. Stack Operations. Stack illustrated. elements of the same type. Week 9. Gaddis: Chapter 18 Stacks and Queues Week 9 Gaddis: Chapter 18 CS 5301 Spring 2017 Ji Seaman Introduction to the Stack Stack: a data structure that hods a coection of eements of the same type. - The eements are accessed

More information

Week 3. Function Definitions. Example: Function. Function Call, Return Statement. Functions & Arrays. Gaddis: Chapters 6 and 7.

Week 3. Function Definitions. Example: Function. Function Call, Return Statement. Functions & Arrays. Gaddis: Chapters 6 and 7. Week 3 Functions & Arrays Gaddis: Chapters 6 and 7 CS 5301 Fall 2015 Jill Seaman 1 Function Definitions! Function definition pattern: datatype identifier (parameter1, parameter2,...) { statements... Where

More information

l A set is a collection of objects of the same l {6,9,11,-5} and {11,9,6,-5} are equivalent. l There is no first element, and no successor of 9.

l A set is a collection of objects of the same l {6,9,11,-5} and {11,9,6,-5} are equivalent. l There is no first element, and no successor of 9. Sets & Hash Tabes Week 13 Weiss: chapter 20 CS 5301 Fa 2017 What are sets? A set is a coection of objects of the same type that has the foowing two properties: - there are no dupicates in the coection

More information

Tutorial 3 Concepts for A1

Tutorial 3 Concepts for A1 CPSC 231 Introduction to Computer Science for Computer Science Majors I Tutoria 3 Concepts for A1 DANNY FISHER dgfisher@ucagary.ca September 23, 2014 Agenda script command more detais Submitting using

More information

Professor: Alvin Chao

Professor: Alvin Chao Professor: Avin Chao Anatomy of a Java Program: Comments Javadoc comments: /** * Appication that converts inches to centimeters. * * @author Chris Mayfied * @version 01/21/2014 */ Everything between /**

More information

Searching, Sorting & Analysis

Searching, Sorting & Analysis Searching, Sorting & Anaysis Unit 2 Chapter 8 CS 2308 Fa 2018 Ji Seaman 1 Definitions of Search and Sort Search: find a given item in an array, return the index of the item, or -1 if not found. Sort: rearrange

More information

! Pass by value: when an argument is passed to a. ! It is implemented using variable initialization. ! Changes to the parameter in the function body

! Pass by value: when an argument is passed to a. ! It is implemented using variable initialization. ! Changes to the parameter in the function body Week 3 Pointers, References, Arrays & Structures Gaddis: Chapters 6, 7, 9, 11 CS 5301 Fall 2013 Jill Seaman 1 Arguments passed by value! Pass by value: when an argument is passed to a function, its value

More information

Functions, Arrays & Structs

Functions, Arrays & Structs Functions, Arrays & Structs Unit 1 Chapters 6-7, 11 Function Definitions! Function definition pattern: datatype identifier (parameter1, parameter2,...) { statements... Where a parameter is: datatype identifier

More information

BITG 1113: Array (Part 1) LECTURE 8

BITG 1113: Array (Part 1) LECTURE 8 BITG 1113: Array (Part 1) LECTURE 8 1 1 LEARNING OUTCOMES At the end of this lecture, you should be able to: 1. Describe the fundamentals of arrays 2. Describe the types of array: One Dimensional (1 D)

More information

Register Allocation. Consider the following assignment statement: x = (a*b)+((c*d)+(e*f)); In posfix notation: ab*cd*ef*++x

Register Allocation. Consider the following assignment statement: x = (a*b)+((c*d)+(e*f)); In posfix notation: ab*cd*ef*++x Register Aocation Consider the foowing assignment statement: x = (a*b)+((c*d)+(e*f)); In posfix notation: ab*cd*ef*++x Assume that two registers are avaiabe. Starting from the eft a compier woud generate

More information

Week 2. Relational Operators. Block or compound statement. if/else. Branching & Looping. Gaddis: Chapters 4 & 5. CS 5301 Spring 2018.

Week 2. Relational Operators. Block or compound statement. if/else. Branching & Looping. Gaddis: Chapters 4 & 5. CS 5301 Spring 2018. Week 2 Branching & Looping Gaddis: Chapters 4 & 5 CS 5301 Spring 2018 Jill Seaman 1 Relational Operators l relational operators (result is bool): == Equal to (do not use =)!= Not equal to > Greater than

More information

understood as processors that match AST patterns of the source language and translate them into patterns in the target language.

understood as processors that match AST patterns of the source language and translate them into patterns in the target language. A Basic Compier At a fundamenta eve compiers can be understood as processors that match AST patterns of the source anguage and transate them into patterns in the target anguage. Here we wi ook at a basic

More information

7.1. Chapter 7: Arrays Hold Multiple Values. Array - Memory Layout. A single variable can only hold one value. Declared using [] operator:

7.1. Chapter 7: Arrays Hold Multiple Values. Array - Memory Layout. A single variable can only hold one value. Declared using [] operator: Chapter 7: 7.1 Arrays Arrays Hold Multiple Values Arrays Hold Multiple Values Array - Memory Layout A single variable can only hold one value int test; 95 Enough memory for 1 int What if we need to store

More information

Chapter 7: Arrays Copyrig opy ht rig 2012 Pea e rson a Educa Educ ti a on, Inc I. nc

Chapter 7: Arrays Copyrig opy ht rig 2012 Pea e rson a Educa Educ ti a on, Inc I. nc Chapter 7: Arrays 7.1 Arrays Hold Multiple Values Arrays Hold Multiple Values Array variable that can store multiple values of the same type (aggregate type) Values are stored in adjacent memory locations

More information

BITG 1233: Array (Part 1) LECTURE 8 (Sem 2, 17/18)

BITG 1233: Array (Part 1) LECTURE 8 (Sem 2, 17/18) BITG 1233: Array (Part 1) LECTURE 8 (Sem 2, 17/18) 1 LEARNING OUTCOMES At the end of this lecture, you should be able to: 1. Describe the fundamentals of arrays 2. Describe the types of array: One Dimensional

More information

7.1. Chapter 7: Arrays Hold Multiple Values. Array - Memory Layout. Array Terminology. Array Terminology 8/23/2014. Arrays Hold Multiple Values

7.1. Chapter 7: Arrays Hold Multiple Values. Array - Memory Layout. Array Terminology. Array Terminology 8/23/2014. Arrays Hold Multiple Values Chapter 7: Arrays 7.1 Arrays Hold Multiple Values Arrays Hold Multiple Values Array: variable that can store multiple values of the same type Values are stored in adjacent memory locations Declared using

More information

ECEn 528 Prof. Archibald Lab: Dynamic Scheduling Part A: due Nov. 6, 2018 Part B: due Nov. 13, 2018

ECEn 528 Prof. Archibald Lab: Dynamic Scheduling Part A: due Nov. 6, 2018 Part B: due Nov. 13, 2018 ECEn 528 Prof. Archibad Lab: Dynamic Scheduing Part A: due Nov. 6, 2018 Part B: due Nov. 13, 2018 Overview This ab's purpose is to expore issues invoved in the design of out-of-order issue processors.

More information

7.1. Chapter 7: Arrays Hold Multiple Values. Array - Memory Layout. Array Terminology. Array Terminology

7.1. Chapter 7: Arrays Hold Multiple Values. Array - Memory Layout. Array Terminology. Array Terminology Chapter 7: Arrays 7.1 Arrays Hold Multiple Values Copyright 2009 Pearson Education, Inc. Copyright Publishing as Pearson 2009 Addison-Wesley Pearson Education, Inc. Publishing as Pearson Addison-Wesley

More information

Searching & Sorting. Definitions of Search and Sort. Other forms of Linear Search. Linear Search. Week 11. Gaddis: 8, 19.6,19.8. CS 5301 Spring 2017

Searching & Sorting. Definitions of Search and Sort. Other forms of Linear Search. Linear Search. Week 11. Gaddis: 8, 19.6,19.8. CS 5301 Spring 2017 Searching & Sorting Week 11 Gaddis: 8, 19.6,19.8 CS 5301 Spring 2017 Ji Seaman 1 Definitions of Search and Sort Search: find a given item in a ist, return the position of the item, or -1 if not found.

More information

while for do while ! set a counter variable to 0 ! increment it inside the loop (each iteration)

while for do while ! set a counter variable to 0 ! increment it inside the loop (each iteration) Week 7: Advanced Loops while Loops in C++ (review) while (expression) may be a compound (a block: {s) Gaddis: 5.7-12 CS 1428 Fall 2015 Jill Seaman 1 for if expression is true, is executed, repeat equivalent

More information

Lecture outline Graphics and Interaction Scan Converting Polygons and Lines. Inside or outside a polygon? Scan conversion.

Lecture outline Graphics and Interaction Scan Converting Polygons and Lines. Inside or outside a polygon? Scan conversion. Lecture outine 433-324 Graphics and Interaction Scan Converting Poygons and Lines Department of Computer Science and Software Engineering The Introduction Scan conversion Scan-ine agorithm Edge coherence

More information

As Michi Henning and Steve Vinoski showed 1, calling a remote

As Michi Henning and Steve Vinoski showed 1, calling a remote Reducing CORBA Ca Latency by Caching and Prefetching Bernd Brügge and Christoph Vismeier Technische Universität München Method ca atency is a major probem in approaches based on object-oriented middeware

More information

Searching & Sorting. Definitions of Search and Sort. Other forms of Linear Search. Linear Search. Week 11. Gaddis: 8, 19.6,19.8.

Searching & Sorting. Definitions of Search and Sort. Other forms of Linear Search. Linear Search. Week 11. Gaddis: 8, 19.6,19.8. Searching & Sorting Week 11 Gaddis: 8, 19.6,19.8 CS 5301 Fa 2017 Ji Seaman 1 Definitions of Search and Sort Search: find a given item in a ist, return the position of the item, or -1 if not found. Sort:

More information

Functions, Arrays & Structs

Functions, Arrays & Structs Functions, Arrays & Structs Unit 1 Chapters 6-7, 11 Function Definitions l Function definition pattern: datatype identifier (parameter1, parameter2,...) { statements... Where a parameter is: datatype identifier

More information

index.pdf March 17,

index.pdf March 17, index.pdf March 17, 2013 1 ITI 1121. Introduction to omputing II Marce Turcotte Schoo of Eectrica Engineering and omputer Science Linked List (Part 2) Tai pointer ouby inked ist ummy node Version of March

More information

A METHOD FOR GRIDLESS ROUTING OF PRINTED CIRCUIT BOARDS. A. C. Finch, K. J. Mackenzie, G. J. Balsdon, G. Symonds

A METHOD FOR GRIDLESS ROUTING OF PRINTED CIRCUIT BOARDS. A. C. Finch, K. J. Mackenzie, G. J. Balsdon, G. Symonds A METHOD FOR GRIDLESS ROUTING OF PRINTED CIRCUIT BOARDS A C Finch K J Mackenzie G J Basdon G Symonds Raca-Redac Ltd Newtown Tewkesbury Gos Engand ABSTRACT The introduction of fine-ine technoogies to printed

More information

Computer Department. Question (1): State whether each of the following is true or false. Question (2): Select the correct answer from the following:

Computer Department. Question (1): State whether each of the following is true or false. Question (2): Select the correct answer from the following: Computer Department Program: Computer Midterm Exam Date : 19/11/2016 Major: Information & communication technology 1 st Semester Time : 1 hr (10:00 11:00) Course: Introduction to Programming 2016/2017

More information

This is a CLOSED-BOOK-CLOSED-NOTES exam consisting of five (5) questions. Write your answer in the answer booklet provided. 1. OO concepts (5 points)

This is a CLOSED-BOOK-CLOSED-NOTES exam consisting of five (5) questions. Write your answer in the answer booklet provided. 1. OO concepts (5 points) COMP2012H Object Oriented Programming and Data Structures Spring Semester 2013 Midterm Exam Soution March 26, 2013, 10:30-11:50am in Room 3598 Instructor: Chi Keung Tang This is a CLOSED-OOK-CLOSED-NOTES

More information

Databases and PHP. Accessing databases from PHP

Databases and PHP. Accessing databases from PHP Databases and PHP Accessing databases from PHP PHP & Databases PHP can connect to virtuay any database There are specific functions buit-into PHP to connect with some DB There is aso generic ODBC functions

More information

Directives & Memory Spaces. Dr. Farid Farahmand Updated: 2/18/2019

Directives & Memory Spaces. Dr. Farid Farahmand Updated: 2/18/2019 Directives & Memory Spaces Dr. Farid Farahmand Updated: 2/18/2019 Memory Types Program Memory Data Memory Stack Interna PIC18 Architecture Data Memory I/O Ports 8 wires 31 x 21 Stack Memory Timers 21 wires

More information

Controls Structure for Repetition

Controls Structure for Repetition Controls Structure for Repetition So far we have looked at the if statement, a control structure that allows us to execute different pieces of code based on certain conditions. However, the true power

More information

PL/SQL, Embedded SQL. Lecture #14 Autumn, Fall, 2001, LRX

PL/SQL, Embedded SQL. Lecture #14 Autumn, Fall, 2001, LRX PL/SQL, Embedded SQL Lecture #14 Autumn, 2001 Fa, 2001, LRX #14 PL/SQL,Embedded SQL HUST,Wuhan,China 402 PL/SQL Found ony in the Orace SQL processor (sqpus). A compromise between competey procedura programming

More information

Lab 2.1: Fixing a C++ program

Lab 2.1: Fixing a C++ program CS 150 Lab 2 Introduction to Compiler Errors, Variables, Assignments and Output The purpose of today s lab session is to allow you to gain experience using primitive data types, constants, assignment statements

More information

Alpha labelings of straight simple polyominal caterpillars

Alpha labelings of straight simple polyominal caterpillars Apha abeings of straight simpe poyomina caterpiars Daibor Froncek, O Nei Kingston, Kye Vezina Department of Mathematics and Statistics University of Minnesota Duuth University Drive Duuth, MN 82-3, U.S.A.

More information

Introduction to OpenMP

Introduction to OpenMP MPSoC Architectures OpenMP Aberto Bosio, Associate Professor UM Microeectronic Departement bosio@irmm.fr Introduction to OpenMP What is OpenMP? Open specification for Muti-Processing Standard API for defining

More information

Chapter 7 Array. Array. C++, How to Program

Chapter 7 Array. Array. C++, How to Program Chapter 7 Array C++, How to Program Deitel & Deitel Spring 2016 CISC 1600 Yanjun Li 1 Array Arrays are data structures containing related data items of same type. An array is a consecutive group of memory

More information

Sonoma State University Computer Science Department CS 115 Fall 2010 Watts. Project 3 Part 1

Sonoma State University Computer Science Department CS 115 Fall 2010 Watts. Project 3 Part 1 Sonoma State University Computer Science Department CS 115 Fall 2010 Watts Project 3 Part 1 For this part of the project you will be modifying one of the programs you submitted for Lab 8 to calculate your

More information

An Optimizing Compiler

An Optimizing Compiler An Optimizing Compier The big difference between interpreters and compiers is that compiers have the abiity to think about how to transate a source program into target code in the most effective way. Usuay

More information

l Determine if a number is odd or even l Determine if a number/character is in a range - 1 to 10 (inclusive) - between a and z (inclusive)

l Determine if a number is odd or even l Determine if a number/character is in a range - 1 to 10 (inclusive) - between a and z (inclusive) Final Exam Exercises Chapters 1-7 + 11 Write C++ code to: l Determine if a number is odd or even CS 2308 Fall 2016 Jill Seaman l Determine if a number/character is in a range - 1 to 10 (inclusive) - between

More information

Outline. Parallel Numerical Algorithms. Forward Substitution. Triangular Matrices. Solving Triangular Systems. Back Substitution. Parallel Algorithm

Outline. Parallel Numerical Algorithms. Forward Substitution. Triangular Matrices. Solving Triangular Systems. Back Substitution. Parallel Algorithm Outine Parae Numerica Agorithms Chapter 8 Prof. Michae T. Heath Department of Computer Science University of Iinois at Urbana-Champaign CS 554 / CSE 512 1 2 3 4 Trianguar Matrices Michae T. Heath Parae

More information

Arrays in Functions!

Arrays in Functions! Arrays in Functions! 1E3! Topic 12! 12 Arrays in Functions 1 Objectives! n This topic should allow students to! n Pass array elements to functions! n Pass whole arrays to functions! n Write functions that

More information

A Fast Block Matching Algorithm Based on the Winner-Update Strategy

A Fast Block Matching Algorithm Based on the Winner-Update Strategy In Proceedings of the Fourth Asian Conference on Computer Vision, Taipei, Taiwan, Jan. 000, Voume, pages 977 98 A Fast Bock Matching Agorithm Based on the Winner-Update Strategy Yong-Sheng Chenyz Yi-Ping

More information

ψ 4 C 3 E C 1 C 4 C 2 ψ 2 B

ψ 4 C 3 E C 1 C 4 C 2 ψ 2 B IMPLEMENTATION OF SLIDING MODE CONTROL IN SIMULINK 4. (R2.). Introduction Květosav Beda Institute of Information Theory and Automation Academy of Sciences of the Czech Repubic Abstract: The paper briefy

More information

Outerjoins, Constraints, Triggers

Outerjoins, Constraints, Triggers Outerjoins, Constraints, Triggers Lecture #13 Autumn, 2001 Fa, 2001, LRX #13 Outerjoins, Constraints, Triggers HUST,Wuhan,China 358 Outerjoin R S = R S with danging tupes padded with nus and incuded in

More information

Add Subtract Multiply Divide

Add Subtract Multiply Divide ARITHMETIC OPERATORS if AND if/else AND while LOOP Order of Operation (Precedence Part 1) Copyright 2014 Dan McElroy Add Subtract Multiply Divide + Add - Subtract * Multiply / Divide = gives the quotient

More information

Abstract Data Type (ADT) & ARRAYS ALGORITHMS & DATA STRUCTURES I COMP 221

Abstract Data Type (ADT) & ARRAYS ALGORITHMS & DATA STRUCTURES I COMP 221 Abstract Data Type (ADT) & ARRAYS ALGORITHMS & DATA STRUCTURES I COMP 221 Abstract Data Type (ADT) Def. a collection of related data items together with an associated set of operations e.g. whole numbers

More information

Extracting semistructured data from the Web: An XQuery Based Approach

Extracting semistructured data from the Web: An XQuery Based Approach EurAsia-ICT 2002, Shiraz-Iran, 29-31 Oct. Extracting semistructured data from the Web: An XQuery Based Approach Gies Nachouki Université de Nantes - Facuté des Sciences, IRIN, 2, rue de a Houssinière,

More information

Purpose of Review. Review some basic C++ Familiarize us with Weiss s style Introduce specific constructs useful for implementing data structures

Purpose of Review. Review some basic C++ Familiarize us with Weiss s style Introduce specific constructs useful for implementing data structures C++ Review 1 Purpose of Review Review some basic C++ Familiarize us with Weiss s style Introduce specific constructs useful for implementing data structures 2 Class The Class defines the data structure

More information

A Design Method for Optimal Truss Structures with Certain Redundancy Based on Combinatorial Rigidity Theory

A Design Method for Optimal Truss Structures with Certain Redundancy Based on Combinatorial Rigidity Theory 0 th Word Congress on Structura and Mutidiscipinary Optimization May 9 -, 03, Orando, Forida, USA A Design Method for Optima Truss Structures with Certain Redundancy Based on Combinatoria Rigidity Theory

More information

Concurrent programming: From theory to practice. Concurrent Algorithms 2016 Tudor David

Concurrent programming: From theory to practice. Concurrent Algorithms 2016 Tudor David oncurrent programming: From theory to practice oncurrent Agorithms 2016 Tudor David From theory to practice Theoretica (design) Practica (design) Practica (impementation) 2 From theory to practice Theoretica

More information

LAB 7.1 Working with One-Dimensional Arrays

LAB 7.1 Working with One-Dimensional Arrays LAB 7.1 Working with One-Dimensional Arrays Copy and paste the following program into Visual Studio IDE. This program will read in a group of test scores (positive integers from 1 to 100) from the keyboard

More information

The American University in Cairo Department of Computer Science & Engineering CSCI &09 Dr. KHALIL Exam-I Fall 2011

The American University in Cairo Department of Computer Science & Engineering CSCI &09 Dr. KHALIL Exam-I Fall 2011 The American University in Cairo Department of Computer Science & Engineering CSCI 106-07&09 Dr. KHALIL Exam-I Fall 2011 Last Name :... ID:... First Name:... Form I Section No.: EXAMINATION INSTRUCTIONS

More information

Zimmer/Porter CSCI130 Fall Lab 6 Selection. 1. Begin by copying the file from my directory into your account (name it lab6.

Zimmer/Porter CSCI130 Fall Lab 6 Selection. 1. Begin by copying the file from my directory into your account (name it lab6. Zimmer/Porter CSCI130 Fall 2018 Lab 6 Selection Complete the following activities: 1. Begin by copying the file from my directory into your account (name it lab6.cpp): cp ~aporter/labs/lab6.cpp lab6.cpp

More information

Data Management Updates

Data Management Updates Data Management Updates Jenny Darcy Data Management Aiance CRP Meeting, Thursday, November 1st, 2018 Presentation Objectives New staff Update on Ingres (JCCS) conversion project Fina IRB cosure at study

More information

Arrays in C++ Instructor: Andy Abreu

Arrays in C++ Instructor: Andy Abreu Arrays in C++ Instructor: Andy Abreu Reason behind the idea When we are programming, often we have to process a large amount of information. We can do so by creating a lot of variables to keep track of

More information

ECE 172 Digital Systems. Chapter 5 Uniprocessor Data Cache. Herbert G. Mayer, PSU Status 6/10/2018

ECE 172 Digital Systems. Chapter 5 Uniprocessor Data Cache. Herbert G. Mayer, PSU Status 6/10/2018 ECE 172 Digita Systems Chapter 5 Uniprocessor Data Cache Herbert G. Mayer, PSU Status 6/10/2018 1 Syabus UP Caches Cache Design Parameters Effective Time t eff Cache Performance Parameters Repacement Poicies

More information

On-Chip CNN Accelerator for Image Super-Resolution

On-Chip CNN Accelerator for Image Super-Resolution On-Chip CNN Acceerator for Image Super-Resoution Jung-Woo Chang and Suk-Ju Kang Dept. of Eectronic Engineering, Sogang University, Seou, South Korea {zwzang91, sjkang}@sogang.ac.kr ABSTRACT To impement

More information

C++ Arrays. C++ Spring 2000 Arrays 1

C++ Arrays. C++ Spring 2000 Arrays 1 C++ Arrays C++ Spring 2000 Arrays 1 C++ Arrays An array is a consecutive group of memory locations. Each group is called an element of the array. The contents of each element are of the same type. Could

More information

Extended Node-Arc Formulation for the K-Edge-Disjoint Hop-Constrained Network Design Problem

Extended Node-Arc Formulation for the K-Edge-Disjoint Hop-Constrained Network Design Problem Extended Node-Arc Formuation for the K-Edge-Disjoint Hop-Constrained Network Design Probem Quentin Botton Université cathoique de Louvain, Louvain Schoo of Management, (Begique) botton@poms.uc.ac.be Bernard

More information

UEE1302(1066) F12: Introduction to Computers and Programming Function (II) - Parameter

UEE1302(1066) F12: Introduction to Computers and Programming Function (II) - Parameter UEE1302(1066) F12: Introduction to Computers and Programming Function (II) - Parameter What you will learn from Lab 7 In this laboratory, you will understand how to use typical function prototype with

More information

Distance Weighted Discrimination and Second Order Cone Programming

Distance Weighted Discrimination and Second Order Cone Programming Distance Weighted Discrimination and Second Order Cone Programming Hanwen Huang, Xiaosun Lu, Yufeng Liu, J. S. Marron, Perry Haaand Apri 3, 2012 1 Introduction This vignette demonstrates the utiity and

More information

FORM 1 (Please put your name and section number (001/10am or 002/2pm) on the scantron!!!!) CS 161 Exam II: True (A)/False(B) (2 pts each):

FORM 1 (Please put your name and section number (001/10am or 002/2pm) on the scantron!!!!) CS 161 Exam II: True (A)/False(B) (2 pts each): FORM 1 (Please put your name and section number (001/10am or 002/2pm) on the scantron!!!!) CS 161 Exam II: True (A)/False(B) (2 pts each): 1. If a function has default arguments, they can be located anywhere

More information

Special Edition Using Microsoft Excel Selecting and Naming Cells and Ranges

Special Edition Using Microsoft Excel Selecting and Naming Cells and Ranges Specia Edition Using Microsoft Exce 2000 - Lesson 3 - Seecting and Naming Ces and.. Page 1 of 8 [Figures are not incuded in this sampe chapter] Specia Edition Using Microsoft Exce 2000-3 - Seecting and

More information

C++ Basics. Lecture 2 COP 3014 Spring January 8, 2018

C++ Basics. Lecture 2 COP 3014 Spring January 8, 2018 C++ Basics Lecture 2 COP 3014 Spring 2018 January 8, 2018 Structure of a C++ Program Sequence of statements, typically grouped into functions. function: a subprogram. a section of a program performing

More information

Note: The buy help from the TA for points will apply on this exam as well, so please read that carefully.

Note: The buy help from the TA for points will apply on this exam as well, so please read that carefully. CS 215 Spring 2018 Lab Exam 1 Review Material: - All material for the course up through the Arrays I slides - Nothing from the slides on Functions, Array Arguments, or Implementing Functions Format: -

More information

An Exponential Time 2-Approximation Algorithm for Bandwidth

An Exponential Time 2-Approximation Algorithm for Bandwidth An Exponentia Time 2-Approximation Agorithm for Bandwidth Martin Fürer 1, Serge Gaspers 2, Shiva Prasad Kasiviswanathan 3 1 Computer Science and Engineering, Pennsyvania State University, furer@cse.psu.edu

More information

Selection Control Structure CSC128: FUNDAMENTALS OF COMPUTER PROBLEM SOLVING

Selection Control Structure CSC128: FUNDAMENTALS OF COMPUTER PROBLEM SOLVING Selection Control Structure CSC128: FUNDAMENTALS OF COMPUTER PROBLEM SOLVING MULTIPLE SELECTION To solve a problem that has several selection, use either of the following method: Multiple selection nested

More information

Chapter 9 Introduction to Arrays. Fundamentals of Java

Chapter 9 Introduction to Arrays. Fundamentals of Java Chapter 9 Introduction to Arrays Objectives Write programs that handle collections of similar items. Declare array variables and instantiate array objects. Manipulate arrays with loops, including the enhanced

More information

Learning Objectives: General Description: DONE DONE Structure Chart

Learning Objectives: General Description: DONE DONE Structure Chart 1 CS 215 Fall 2017 Project 2: Grade Calculator Due October 9 @ midnight Version 2.1 Published 9/24 changes in Red [DUE DATE changed 10/3] Learning Objectives: - Developing a C++ program using the Procedure-Oriented

More information

Bottom-Up Parsing LR(1)

Bottom-Up Parsing LR(1) Bottom-Up Parsing LR(1) Previousy we have studied top-down or LL(1) parsing. The idea here was to start with the start symbo and keep expanding it unti the whoe input was read and matched. In bottom-up

More information

Arrays. Arizona State University 1

Arrays. Arizona State University 1 Arrays CSE100 Principles of Programming with C++, Fall 2018 (based off Chapter 8 slides by Pearson) Ryan Dougherty Arizona State University http://www.public.asu.edu/~redoughe/ Arizona State University

More information

Sensitivity Analysis of Hopfield Neural Network in Classifying Natural RGB Color Space

Sensitivity Analysis of Hopfield Neural Network in Classifying Natural RGB Color Space Sensitivity Anaysis of Hopfied Neura Network in Cassifying Natura RGB Coor Space Department of Computer Science University of Sharjah UAE rsammouda@sharjah.ac.ae Abstract: - This paper presents a study

More information

Outline. Review Choice Statements. Review Sequential Flow. Review Choice Before Loops. Review Choice After Loops

Outline. Review Choice Statements. Review Sequential Flow. Review Choice Before Loops. Review Choice After Loops Programming with If Statements using Multiple Conditions Larry Caretto Computer Science 106 Computing in Engineering and Science February 23, 2006 Outline Review last class Program flow controls if s Exercises

More information

Meeting Exchange 4.1 Service Pack 2 Release Notes for the S6200/S6800 Servers

Meeting Exchange 4.1 Service Pack 2 Release Notes for the S6200/S6800 Servers Meeting Exchange 4.1 Service Pack 2 Reease Notes for the S6200/S6800 Servers The Meeting Exchange S6200/S6800 Media Servers are SIP-based voice and web conferencing soutions that extend Avaya s conferencing

More information

Pointers and Arrays CS 201. This slide set covers pointers and arrays in C++. You should read Chapter 8 from your Deitel & Deitel book.

Pointers and Arrays CS 201. This slide set covers pointers and arrays in C++. You should read Chapter 8 from your Deitel & Deitel book. Pointers and Arrays CS 201 This slide set covers pointers and arrays in C++. You should read Chapter 8 from your Deitel & Deitel book. Pointers Powerful but difficult to master Used to simulate pass-by-reference

More information

9.2 Pointer Variables. Pointer Variables CS Pointer Variables. Pointer Variables. 9.1 Getting the Address of a. Variable

9.2 Pointer Variables. Pointer Variables CS Pointer Variables. Pointer Variables. 9.1 Getting the Address of a. Variable CS 1400 Chapter 9 9.1 Getting the Address of a Variable A variable has: Name Value Location in a memory Type The location in memory is an address Use address operator & to get address of a variable: int

More information

Automatic Hidden Web Database Classification

Automatic Hidden Web Database Classification Automatic idden Web atabase Cassification Zhiguo Gong, Jingbai Zhang, and Qian Liu Facuty of Science and Technoogy niversity of Macau Macao, PRC {fstzgg,ma46597,ma46620}@umac.mo Abstract. In this paper,

More information

Sample of a training manual for a software tool

Sample of a training manual for a software tool Sampe of a training manua for a software too We use FogBugz for tracking bugs discovered in RAPPID. I wrote this manua as a training too for instructing the programmers and engineers in the use of FogBugz.

More information

CS31 Discussion 1E. Jie(Jay) Wang Week1 Sept. 30

CS31 Discussion 1E. Jie(Jay) Wang Week1 Sept. 30 CS31 Discussion 1E Jie(Jay) Wang Week1 Sept. 30 About me Jie Wang E-mail: holawj@gmail.com Office hour: Wednesday 3:30 5:30 BH2432 Thursday 12:30 1:30 BH2432 Slides of discussion will be uploaded to the

More information

Outline. Introduction. Arrays declarations and initialization. Const variables. Character arrays. Static arrays. Examples.

Outline. Introduction. Arrays declarations and initialization. Const variables. Character arrays. Static arrays. Examples. Outline Introduction. Arrays declarations and initialization. Const variables. Character arrays. Static arrays. Examples. 1 Arrays I Array One type of data structures. Consecutive group of memory locations

More information

! A program is a set of instructions that the. ! It must be translated. ! Variable: portion of memory that stores a value. char

! A program is a set of instructions that the. ! It must be translated. ! Variable: portion of memory that stores a value. char Week 1 Operators, Data Types & I/O Gaddis: Chapters 1, 2, 3 CS 5301 Fall 2016 Jill Seaman Programming A program is a set of instructions that the computer follows to perform a task It must be translated

More information

MCSE TestPrep SQL Server 6.5 Design & Implementation - 3- Data Definition

MCSE TestPrep SQL Server 6.5 Design & Implementation - 3- Data Definition MCSE TestPrep SQL Server 6.5 Design & Impementation - Data Definition Page 1 of 38 [Figures are not incuded in this sampe chapter] MCSE TestPrep SQL Server 6.5 Design & Impementation - 3- Data Definition

More information

CSE120 Principles of Operating Systems. Prof Yuanyuan (YY) Zhou Advanced Memory Management

CSE120 Principles of Operating Systems. Prof Yuanyuan (YY) Zhou Advanced Memory Management CSE120 Principes of Operating Systems Prof Yuanyuan (YY) Zhou Advanced Memory Management Advanced Functionaity Now we re going to ook at some advanced functionaity that the OS can provide appications using

More information

Validation companies were selected with the following criteria, they all:

Validation companies were selected with the following criteria, they all: A comparison of emai vaidation performance August 2016 A reguar comparative evauation of emai vaidation services for businesses Vaidation companies were seected with the foowing criteria, they a: offer

More information

Further Concepts in Geometry

Further Concepts in Geometry ppendix F Further oncepts in Geometry F. Exporing ongruence and Simiarity Identifying ongruent Figures Identifying Simiar Figures Reading and Using Definitions ongruent Trianges assifying Trianges Identifying

More information