C++ For Science and Engineering Lecture 8

Size: px
Start display at page:

Download "C++ For Science and Engineering Lecture 8"

Transcription

1 C++ For Science and Engineering Lecture 8 John Chrispell Tulane University Friday 10, 2010

2 Arrays Structures are ways of storing more than one type of information together. A structure is a vesatile data form that can hold items fo more thatn one data type. They allow you to unify your data representation. They are user defined types, with a structure declaration serving to define the types data properties. John Chrispell, Friday 10, 2010 slide 3/29

3 Arrays Suppose that you are in need a storing information about designer inflatables that has: name volume price A C/C++ structure that will allow for this is: s t r u c t i n f l a t a b l e { // s t r u c t u r e d e c l a r a t i o n char name [ 2 0 ] ; // s t r u c t u r e members f l o a t volume ; double p r i c e ; } ; The keyword struct indicates that the code defines the layout for a new structure. The identifierinflatable, is the name or tag given to the structure. John Chrispell, Friday 10, 2010 slide 5/29

4 Arrays Once we have this template in place we can create variables of this type. i n f l a t a b l e hat ; // C++ type i n f l a t a b l e v a r i a b l e i n f l a t a b l e w o o p i e c u s h i o n ; // C++ s t r u c t i n f l a t a b l e goose ; // C r e q u i r e s word s t r u c t i n f l a t a b l e v i n c e n t ; Note that unlike in C we do not need to use struct in the declaration. We use the membership operator (.) to access individual members in the structure. Lets look at an example: John Chrispell, Friday 10, 2010 slide 7/29

5 structur.cpp #i n c l u d e <i o s t r e a m > s t r u c t i n f l a t a b l e // s t r u c t u r e d e c l a r a t i o n { char name [ 2 0 ] ; f l o a t volume ; double p r i c e ; } ; i n t main ( ) { using namespace std ; i n f l a t a b l e g u e s t = { G l o r i o u s G l o r i a, // name v a l u e , // volume v a l u e // p r i c e v a l u e } ; // g u e s t i s a s t r u c t u r e v a r i a b l e o f type i n f l a t a b l e // I t s i n i t i a l i z e d to the i n d i c a t e d v a l u e s i n f l a t a b l e p a l = { Audacious Arthur, , } ; / p a l i s a second v a r i a b l e o f type i n f l a t a b l e / cout << Expand your guest l i s t with << guest. name ; cout << and << p a l. name <<! \ n ; / p a l. name i s the name member o f the p a l v a r i a b l e / cout << You can have both f o r $ ; cout << g u e s t. p r i c e + p a l. p r i c e <<! \ n ; } return 0 ; John Chrispell, Friday 10, 2010 slide 9/29

6 Note on the structur.cpp file The structure was defined external to the program and can be used by all the functions in the file. If we had included the structrue definition inside the main function it can only be used inside the main function. Note the initialization can be done on separate lines or all together in one. Depending on your compiler you may be able to use a string inside the structure for the name field. You can also assign one structure to another. John Chrispell, Friday 10, 2010 slide 11/29

7 assgnst.cpp #i n c l u d e <iostream > #i n c l u d e <s t r i n g > s t r u c t i n f l a t a b l e { s t d : : s t r i n g name ; f l o a t volume ; double p r i c e ; } ; i n t main ( ) { } using namespace std ; i n f l a t a b l e bouquet = { s u n f l o w e r s, , } ; i n f l a t a b l e c h o i c e ; cout << bouquet : << bouquet. name << f o r $ ; cout << bouquet. p r i c e << e n d l ; c h o i c e = bouquet ; / a s s i g n one s t r u c t u r e to a n o t h e r / cout << c h o i c e : << c h o i c e. name << f o r $ ; cout << c h o i c e. p r i c e << e n d l ; return 0 ; John Chrispell, Friday 10, 2010 slide 13/29

8 A struct with no typename! You can create a structure with no type name. You do this by omitting a tag name while simultaneously defining a structure form and a variable: s t r u c t { // No tag i n t x ; i n t y ; } p o s i t i o n ; // a s t r u c t u r e v a r i a b l e You can use the membership operator with the variable position now, as in position.x. Note there is no general name for the type. We can now consider the following listing with an array of structs: John Chrispell, Friday 10, 2010 slide 15/29

9 arrstruc.cpp #i n c l u d e <i o s t r e a m > s t r u c t i n f l a t a b l e { } ; char name [ 2 0 ] ; f l o a t volume ; double p r i c e ; i n t main ( ) { using namespace std ; / ========================================== / / I n i t a l i z e two i n f l a t a b l e s / / ========================================== / i n f l a t a b l e g u e s t s [ 2 ] = { { Bambi, 0. 5, }, { Godzilla, 2000, } } ; / ========================================== / / Display some information about the s t r u c t s / / ========================================== / cout << The guests << guests [ 0 ]. name << and << guests [ 1 ]. name << \ nhave a combined volume o f << g u e s t s [ 0 ]. volume + g u e s t s [ 1 ]. volume << c u b i c f e e t. \ n ; } return 0 ; John Chrispell, Friday 10, 2010 slide 17/29

10 Unions A union is a data format that can hold different data types but only one at a time. The format is close to that of a structure. union o n e 4 a l l { i n t i n t v a l ; long l o n g v a l ; double d o u b l e v a l ; } ; You can use a one4all to hold an int, a long, or a double as long as you do so at different times: o n e 4 a l l p a i l ; p a i l. i n t v a l = 1 5 ; cout << p a i l. i n t v a l ; p a i l. d o u b l e v a l = ; // the i n t v a l u e i s l o s t! cout << p a i l. d o u b l e v a l ; John Chrispell, Friday 10, 2010 slide 19/29

11 Enumerations An enumeration or enum is nother way of creating a symbolic constants. enum spectrum { red, orange, y e l l o w, green, blue, i n d i g o, v i o l e t } ; / spectrum i s the name o f the new t y p e / This establishes red, orange, yellow, and so on as symbolic constants for the integers 0-6. You can now delcare a variable of type spectrum and set its values: spectrum band ; band = orange ; band = spectrum ( 1 ) ; // same as l i n e above ; You can set the enumerator values explicitly by: enum spectrum { red, orange = 0, y e l l o w, g r e e n = 1 } ; These may be useful later when dealing with switch case statements. John Chrispell, Friday 10, 2010 slide 21/29

12 Pointers and the Free Store When storing data we are interested in: Where the information is stored. What value is kept there. What kind of information is stored. This brings us to finding the address for normal variables: For this we use the address operator, represented by &. If name is a varaible, then &name is its address. Consider the next listing: John Chrispell, Friday 10, 2010 slide 23/29

13 address.cpp #i n c l u d e <iostream > i n t main ( ) { } using namespace std ; i n t donuts = 6 ; double cups = 4. 5 ; cout << donuts v a l u e = << donuts ; cout << and donuts a d d r e s s = << &donuts << endl ; / ============================================ / / NOTE: you may need to use unsigned (& donuts ) / / and unsigned (& cups ) / / ============================================ / cout << cups v a l u e = << cups ; cout << and cups a d d r e s s = << &cups << e n d l ; return 0 ; Here we have treated the value as the named quantity and location as the derived quantity. John Chrispell, Friday 10, 2010 slide 25/29

14 Pointer A pointer is a special type of variable that holds the address of the value. Thus, the name of the pointer represents the location and the value is the derived quantity. Applying the * operator, called the indirect value or the dereferencing operator, yields the value at the location. Consider the following listing: John Chrispell, Friday 10, 2010 slide 27/29

15 pointer.cpp #include <iostream > i n t main ( ) { using namespace std ; i n t updates = 6 ; // d e c l a r e a v a r i a b l e i n t p updates ; // d e c l a r e p o i n t e r to an i n t p updates = &updates ; // a s s i g n ad dre s s of i n t to p o i n t e r / ======================= / / e x p r e s s v a l u e s two ways / / ======================= / cout << Values : updates = << updates ; cout <<, p updates = << p updates << endl ; / ======================== / / e x p r e s s a d d r e s s two ways / / ======================== / cout << Addresses : &updates = << &updates ; cout <<, p updates = << p updates << endl ; / =========================== / / use p o i n t e r to change v a l u e / / =========================== / p u p d a t e s = p u p d a t e s + 1 ; cout << Now updates = << updates << endl ; } return 0 ; John Chrispell, Friday 10, 2010 slide 29/29

C++ For Science and Engineering Lecture 10

C++ For Science and Engineering Lecture 10 C++ For Science and Engineering Lecture 10 John Chrispell Tulane University Wednesday 15, 2010 Introducing for loops Often we want programs to do the same action more than once. #i n c l u d e

More information

C++ For Science and Engineering Lecture 14

C++ For Science and Engineering Lecture 14 C++ For Science and Engineering Lecture 14 John Chrispell Tulane University Monday September 27, 2010 File Input and Output Recall writing text to standard out You must include the iostream header file.

More information

C++ For Science and Engineering Lecture 17

C++ For Science and Engineering Lecture 17 C++ For Science and Engineering Lecture 17 John Chrispell Tulane University Monday October 4, 2010 Functions and C-Style Strings Three methods for representing the C-style string: An array of char A quoted

More information

C++ For Science and Engineering Lecture 13

C++ For Science and Engineering Lecture 13 C++ For Science and Engineering Lecture 13 John Chrispell Tulane University Wednesday September 22, 2010 Logical Expressions: Sometimes you want to use logical and and logical or (even logical not) in

More information

CS 7B - Fall Final Exam (take-home portion). Due Wednesday, 12/13 at 2 pm

CS 7B - Fall Final Exam (take-home portion). Due Wednesday, 12/13 at 2 pm CS 7B - Fall 2017 - Final Exam (take-home portion). Due Wednesday, 12/13 at 2 pm Write your responses to following questions on separate paper. Use complete sentences where appropriate and write out code

More information

import java. u t i l. ;... Scanner sc = new Scanner ( System. in ) ;

import java. u t i l. ;... Scanner sc = new Scanner ( System. in ) ; CPSC 490 Input Input will always arrive on stdin. You may assume input is well-formed with respect to the problem specification; inappropriate input (e.g. text where a number was specified, number out

More information

APPENDIX A FASTFLOW A.1 DESIGN PRINCIPLES

APPENDIX A FASTFLOW A.1 DESIGN PRINCIPLES APPENDIX A FASTFLOW A.1 DESIGN PRINCIPLES FastFlow 1 has been designed to provide programmers with efficient parallelism exploitation patterns suitable to implement (fine grain) stream parallel applications.

More information

Comp 11 Lectures. Mike Shah. July 12, Tufts University. Mike Shah (Tufts University) Comp 11 Lectures July 12, / 33

Comp 11 Lectures. Mike Shah. July 12, Tufts University. Mike Shah (Tufts University) Comp 11 Lectures July 12, / 33 Comp 11 Lectures Mike Shah Tufts University July 12, 2017 Mike Shah (Tufts University) Comp 11 Lectures July 12, 2017 1 / 33 Please do not distribute or host these slides without prior permission. Mike

More information

Programsystemkonstruktion med C++: Övning 1. Karl Palmskog Translated by: Siavash Soleimanifard. September 2011

Programsystemkonstruktion med C++: Övning 1. Karl Palmskog Translated by: Siavash Soleimanifard. September 2011 Programsystemkonstruktion med C++: Övning 1 Karl Palmskog palmskog@kth.se Translated by: Siavash Soleimanifard September 2011 Programuppbyggnad Klassens uppbyggnad A C++ class consists of a declaration

More information

Cluster Algorithms to Reduce Critical Slowing Down

Cluster Algorithms to Reduce Critical Slowing Down Cluster Algorithms to Reduce Critical Slowing Down Monte Carlo simulations close to a phase transition are affected by critical slowing down. In the 2-D Ising system, the correlation length ξ becomes very

More information

E23: Hotel Management System Wen Yunlu Hu Xing Chen Ke Tang Haoyuan Module: EEE 101

E23: Hotel Management System Wen Yunlu Hu Xing Chen Ke Tang Haoyuan Module: EEE 101 E23: Hotel Management System Author: 1302509 Zhao Ruimin 1301478 Wen Yunlu 1302575 Hu Xing 1301911 Chen Ke 1302599 Tang Haoyuan Module: EEE 101 Lecturer: Date: Dr.Lin December/22/2014 Contents Contents

More information

Computational Physics (6810): Session 2

Computational Physics (6810): Session 2 Computational Physics (6810): Session 2 Dick Furnstahl Nuclear Theory Group OSU Physics Department January 13, 2017 Session 1 follow-ups Types of error Reminder of power laws Session 1 follow-ups Session

More information

Applied C Fri

Applied C Fri Applied C++11 2013-01-25 Fri Outline Introduction Auto-Type Inference Lambda Functions Threading Compiling C++11 C++11 (formerly known as C++0x) is the most recent version of the standard of the C++ Approved

More information

Introduction to functions

Introduction to functions Introduction to functions Comp Sci 1570 Introduction to C++ Outline 1 2 Functions A function is a reusable sequence of s designed to do a particular job. In C++, a function is a group of s that is given

More information

Congratulations you're done with CS103 problem sets! Please evaluate this course on Axess!

Congratulations you're done with CS103 problem sets! Please evaluate this course on Axess! The Big Picture Announcements Problem Set 9 due right now. We'll release solutions right after lecture. Congratulations you're done with CS103 problem sets! Practice final exam is Monday, December 8 from

More information

Searching. Constant time access. Hash function. Use an array? Better hash function? Hash function 4/18/2013. Chapter 9

Searching. Constant time access. Hash function. Use an array? Better hash function? Hash function 4/18/2013. Chapter 9 Constant time access Searching Chapter 9 Linear search Θ(n) OK Binary search Θ(log n) Better Can we achieve Θ(1) search time? CPTR 318 1 2 Use an array? Use random access on a key such as a string? Hash

More information

CS 7B - Fall Assignment 4: Exploring Wumpus (Linked Rooms). Due 12/13/18

CS 7B - Fall Assignment 4: Exploring Wumpus (Linked Rooms). Due 12/13/18 CS 7B - Fall 2018 - Assignment 4: Exploring Wumpus (Linked Rooms). Due 12/13/18 In this project we ll build, investigate and augment the the game Hunt the Wumpus, as described in exercise 12 or PPP2, Chapter

More information

CPSC 490 Problem Solving in Computer Science

CPSC 490 Problem Solving in Computer Science CPSC 490 Problem Solving in Computer Science Lecture 6: Recovering Solutions from DP, Bitmask DP, Matrix Exponentiation David Zheng and Daniel Du Based on CPSC490 slides from 2014-2017 2018/01/23 Announcements

More information

Numerical solution of the time-independent 1-D Schrödinger equation. Matthias E. Möbius. September 24, 2010

Numerical solution of the time-independent 1-D Schrödinger equation. Matthias E. Möbius. September 24, 2010 Numerical solution of the time-independent 1-D Schrödinger equation Matthias E. Möbius September 24, 2010 1 Aim of the computational lab Numerical solution of the one-dimensional stationary Schrödinger

More information

2. Write a recursive function to add the first n terms of the alternating harmonic series:

2. Write a recursive function to add the first n terms of the alternating harmonic series: CS 7B - Spring 2014 - Midterm 2. 5/8/14 Write responses on separate paper. 1. Write a recursive method that uses only addition, subtraction, and comparison to multiply two numbers. The basic engine for

More information

Comp 11 Lectures. Mike Shah. June 20, Tufts University. Mike Shah (Tufts University) Comp 11 Lectures June 20, / 38

Comp 11 Lectures. Mike Shah. June 20, Tufts University. Mike Shah (Tufts University) Comp 11 Lectures June 20, / 38 Comp 11 Lectures Mike Shah Tufts University June 20, 2017 Mike Shah (Tufts University) Comp 11 Lectures June 20, 2017 1 / 38 Please do not distribute or host these slides without prior permission. Mike

More information

Functional Programming with F# Overview and Basic Concepts

Functional Programming with F# Overview and Basic Concepts Functional Programming with F# Overview and Basic Concepts Radu Nicolescu Department of Computer Science University of Auckland 27 Sep 2017 1 / 52 1 Background 2 Overview 3 Type System and Type Inference

More information

INTRODUCTION. This is not a full c-programming course. It is not even a full 'Java to c' programming course.

INTRODUCTION. This is not a full c-programming course. It is not even a full 'Java to c' programming course. C PROGRAMMING 1 INTRODUCTION This is not a full c-programming course. It is not even a full 'Java to c' programming course. 2 LITTERATURE 3. 1 FOR C-PROGRAMMING The C Programming Language (Kernighan and

More information

Session 5 (last revised: January 24, 2010) 5 1

Session 5 (last revised: January 24, 2010) 5 1 782 Session 5 (last revised: January 24, 21) 5 1 5 782 Session 5 a Follow-up to Numerical Derivative Round-Off Errors In Session 4, we looked at error plots for various ways to calculate numerical derivatives

More information

Algebra II Through Competitions Chapter 7 Function Composition and Operations

Algebra II Through Competitions Chapter 7 Function Composition and Operations . FUNCTIONS. Definition A function is a relationship between the independent variable x and dependent variable y. Each value of x corresponds exactly one value of y. Note two different values of x can

More information

Congratulations you're done with CS103 problem sets! Please evaluate this course on Axess!

Congratulations you're done with CS103 problem sets! Please evaluate this course on Axess! The Big Picture Announcements Problem Set 9 due right now. We'll release solutions right after lecture. Congratulations you're done with CS103 problem sets! Please evaluate this course on Axess! Your feedback

More information

Google Go illustrated on the basis of Fibonacci numbers

Google Go illustrated on the basis of Fibonacci numbers Google Go illustrated on the basis of Fibonacci numbers Jan Pennekamp RWTH University Aachen Chair for Data Management and Data Exploration Prof. Dr. T. Seidl Supervision: Dipl.-Ing. Marwan Hassani Friday,

More information

ACM-ICPC South Western European Regional SWERC 2008

ACM-ICPC South Western European Regional SWERC 2008 ACM-ICPC South Western European Regional SWERC 2008 FAU Contest Team icpc@i2.informatik.uni-erlangen.de Friedrich-Alexander Universität Erlangen-Nürnberg November, 23 2008 FAU Contest Team ACM-ICPC South

More information

Searching, mainly via Hash tables

Searching, mainly via Hash tables Data structures and algorithms Part 11 Searching, mainly via Hash tables Petr Felkel 26.1.2007 Topics Searching Hashing Hash function Resolving collisions Hashing with chaining Open addressing Linear Probing

More information

ITI Introduction to Computing II

ITI Introduction to Computing II (with contributions from R. Holte) School of Electrical Engineering and Computer Science University of Ottawa Version of January 9, 2019 Please don t print these lecture notes unless you really need to!

More information

On my honor, as an Aggie, I have neither given nor received unauthorized aid on this academic work

On my honor, as an Aggie, I have neither given nor received unauthorized aid on this academic work Lab 5 : Linking Name: Sign the following statement: On my honor, as an Aggie, I have neither given nor received unauthorized aid on this academic work 1 Objective The main objective of this lab is to experiment

More information

Example problem: Adaptive solution of the 2D advection diffusion equation

Example problem: Adaptive solution of the 2D advection diffusion equation Chapter 1 Example problem: Adaptive solution of the 2D advection diffusion equation In this example we discuss the adaptive solution of the 2D advection-diffusion problem Solve Two-dimensional advection-diffusion

More information

Computational Models Lecture 8 1

Computational Models Lecture 8 1 Computational Models Lecture 8 1 Handout Mode Ronitt Rubinfeld and Iftach Haitner. Tel Aviv University. May 11/13, 2015 1 Based on frames by Benny Chor, Tel Aviv University, modifying frames by Maurice

More information

CS 221 Lecture 9. Tuesday, 1 November 2011

CS 221 Lecture 9. Tuesday, 1 November 2011 CS 221 Lecture 9 Tuesday, 1 November 2011 Some slides in this lecture are from the publisher s slides for Engineering Computation: An Introduction Using MATLAB and Excel 2009 McGraw-Hill Today s Agenda

More information

ITI Introduction to Computing II

ITI Introduction to Computing II (with contributions from R. Holte) School of Electrical Engineering and Computer Science University of Ottawa Version of January 11, 2015 Please don t print these lecture notes unless you really need to!

More information

Notater: INF3331. Veronika Heimsbakk December 4, Introduction 3

Notater: INF3331. Veronika Heimsbakk December 4, Introduction 3 Notater: INF3331 Veronika Heimsbakk veronahe@student.matnat.uio.no December 4, 2013 Contents 1 Introduction 3 2 Bash 3 2.1 Variables.............................. 3 2.2 Loops...............................

More information

Comp 11 Lectures. Mike Shah. July 26, Tufts University. Mike Shah (Tufts University) Comp 11 Lectures July 26, / 40

Comp 11 Lectures. Mike Shah. July 26, Tufts University. Mike Shah (Tufts University) Comp 11 Lectures July 26, / 40 Comp 11 Lectures Mike Shah Tufts University July 26, 2017 Mike Shah (Tufts University) Comp 11 Lectures July 26, 2017 1 / 40 Please do not distribute or host these slides without prior permission. Mike

More information

Round 5: Hashing. Tommi Junttila. Aalto University School of Science Department of Computer Science

Round 5: Hashing. Tommi Junttila. Aalto University School of Science Department of Computer Science Round 5: Hashing Tommi Junttila Aalto University School of Science Department of Computer Science CS-A1140 Data Structures and Algorithms Autumn 017 Tommi Junttila (Aalto University) Round 5 CS-A1140 /

More information

The Monte Carlo Algorithm

The Monte Carlo Algorithm The Monte Carlo Algorithm This algorithm was invented by N. Metropolis, A.W. Rosenbluth, M.N. Rosenbluth, A.H. Teller, and E. Teller, J. Chem. Phys., 21, 1087 (1953). It was listed as one of the The Top

More information

Design of discrete-event simulations

Design of discrete-event simulations Design of discrete-event simulations Lecturer: Dmitri A. Moltchanov E-mail: moltchan@cs.tut.fi http://www.cs.tut.fi/kurssit/tlt-2707/ OUTLINE: Discrete event simulation; Event advance design; Unit-time

More information

Introduction to Programming (Java) 3/12

Introduction to Programming (Java) 3/12 Introduction to Programming (Java) 3/12 Michal Krátký Department of Computer Science Technical University of Ostrava Introduction to Programming (Java) 2008/2009 c 2006 2008 Michal Krátký Introduction

More information

CS60007 Algorithm Design and Analysis 2018 Assignment 1

CS60007 Algorithm Design and Analysis 2018 Assignment 1 CS60007 Algorithm Design and Analysis 2018 Assignment 1 Palash Dey and Swagato Sanyal Indian Institute of Technology, Kharagpur Please submit the solutions of the problems 6, 11, 12 and 13 (written in

More information

CSE 20. Lecture 4: Introduction to Boolean algebra. CSE 20: Lecture4

CSE 20. Lecture 4: Introduction to Boolean algebra. CSE 20: Lecture4 CSE 20 Lecture 4: Introduction to Boolean algebra Reminder First quiz will be on Friday (17th January) in class. It is a paper quiz. Syllabus is all that has been done till Wednesday. If you want you may

More information

Computational Models Lecture 8 1

Computational Models Lecture 8 1 Computational Models Lecture 8 1 Handout Mode Ronitt Rubinfeld and Iftach Haitner. Tel Aviv University. April 18/ May 2, 2016 1 Based on frames by Benny Chor, Tel Aviv University, modifying frames by Maurice

More information

3. Replace any row by the sum of that row and a constant multiple of any other row.

3. Replace any row by the sum of that row and a constant multiple of any other row. Section. Solution of Linear Systems by Gauss-Jordan Method A matrix is an ordered rectangular array of numbers, letters, symbols or algebraic expressions. A matrix with m rows and n columns has size or

More information

Computational Models Lecture 8 1

Computational Models Lecture 8 1 Computational Models Lecture 8 1 Handout Mode Nachum Dershowitz & Yishay Mansour. Tel Aviv University. May 17 22, 2017 1 Based on frames by Benny Chor, Tel Aviv University, modifying frames by Maurice

More information

B-Spline Interpolation on Lattices

B-Spline Interpolation on Lattices B-Spline Interpolation on Lattices David Eberly, Geometric Tools, Redmond WA 98052 https://www.geometrictools.com/ This work is licensed under the Creative Commons Attribution 4.0 International License.

More information

ENS Lyon Camp. Day 5. Basic group. C October

ENS Lyon Camp. Day 5. Basic group. C October ENS Lyon Camp. Day 5. Basic group. C++. 30 October Contents 1 Input/Output 1 1.1 C-style.......................................... 1 1. C++-style........................................ Stack Overflow

More information

Anatomy of SINGULAR talk at p. 1

Anatomy of SINGULAR talk at p. 1 Anatomy of SINGULAR talk at MaGiX@LIX 2011- p. 1 Anatomy of SINGULAR talk at MaGiX@LIX 2011 - Hans Schönemann hannes@mathematik.uni-kl.de Department of Mathematics University of Kaiserslautern Anatomy

More information

The Euler Method for the Initial Value Problem

The Euler Method for the Initial Value Problem The Euler Method for the Initial Value Problem http://people.sc.fsu.edu/ jburkardt/isc/week10 lecture 18.pdf... ISC3313: Introduction to Scientific Computing with C++ Summer Semester 2011... John Burkardt

More information

FIT100 Spring 01. Project 2. Astrological Toys

FIT100 Spring 01. Project 2. Astrological Toys FIT100 Spring 01 Project 2 Astrological Toys In this project you will write a series of Windows applications that look up and display astrological signs and dates. The applications that will make up the

More information

CS 7B - Spring Assignment: Ramsey Theory with Matrices and SFML. due 5/23/18

CS 7B - Spring Assignment: Ramsey Theory with Matrices and SFML. due 5/23/18 CS 7B - Spring 2018 - Assignment: Ramsey Theory with Matrices and SFML. due 5/23/18 Background Theory Ramsey theory, named after the British mathematician and philosopher Frank P. Ramsey, is a branch of

More information

Regression With a Categorical Independent Variable

Regression With a Categorical Independent Variable Regression ith a Independent Variable ERSH 8320 Slide 1 of 34 Today s Lecture Regression with a single categorical independent variable. Today s Lecture Coding procedures for analysis. Dummy coding. Relationship

More information

Lab 6: Linear Algebra

Lab 6: Linear Algebra 6.1 Introduction Lab 6: Linear Algebra This lab is aimed at demonstrating Python s ability to solve linear algebra problems. At the end of the assignment, you should be able to write code that sets up

More information

compare to comparison and pointer based sorting, binary trees

compare to comparison and pointer based sorting, binary trees Admin Hashing Dictionaries Model Operations. makeset, insert, delete, find keys are integers in M = {1,..., m} (so assume machine word size, or unit time, is log m) can store in array of size M using power:

More information

Variations on Conway s Game of Life and Other Cellular Automata. David Hua and Martin Pelikan

Variations on Conway s Game of Life and Other Cellular Automata. David Hua and Martin Pelikan Variations on Conway s Game of Life and Other Cellular Automata David Hua and Martin Pelikan Research Paper Presented to the Students and Teachers as Research Scientists Program at the University of Missouri-St.

More information

Aside: Golden Ratio. Golden Ratio: A universal law. Golden ratio φ = lim n = 1+ b n = a n 1. a n+1 = a n + b n, a n+b n a n

Aside: Golden Ratio. Golden Ratio: A universal law. Golden ratio φ = lim n = 1+ b n = a n 1. a n+1 = a n + b n, a n+b n a n Aside: Golden Ratio Golden Ratio: A universal law. Golden ratio φ = lim n a n+b n a n = 1+ 5 2 a n+1 = a n + b n, b n = a n 1 Ruta (UIUC) CS473 1 Spring 2018 1 / 41 CS 473: Algorithms, Spring 2018 Dynamic

More information

I will post Homework 1 soon, probably over the weekend, due Friday, September 30.

I will post Homework 1 soon, probably over the weekend, due Friday, September 30. Random Variables Friday, September 09, 2011 2:02 PM I will post Homework 1 soon, probably over the weekend, due Friday, September 30. No class or office hours next week. Next class is on Tuesday, September

More information

Outline. policies for the first part. with some potential answers... MCS 260 Lecture 10.0 Introduction to Computer Science Jan Verschelde, 9 July 2014

Outline. policies for the first part. with some potential answers... MCS 260 Lecture 10.0 Introduction to Computer Science Jan Verschelde, 9 July 2014 Outline 1 midterm exam on Friday 11 July 2014 policies for the first part 2 questions with some potential answers... MCS 260 Lecture 10.0 Introduction to Computer Science Jan Verschelde, 9 July 2014 Intro

More information

CS:4330 Theory of Computation Spring Regular Languages. Finite Automata and Regular Expressions. Haniel Barbosa

CS:4330 Theory of Computation Spring Regular Languages. Finite Automata and Regular Expressions. Haniel Barbosa CS:4330 Theory of Computation Spring 2018 Regular Languages Finite Automata and Regular Expressions Haniel Barbosa Readings for this lecture Chapter 1 of [Sipser 1996], 3rd edition. Sections 1.1 and 1.3.

More information

Dr Franck P. Vidal. 27 th September 2014

Dr Franck P. Vidal. 27 th September 2014 gvirtualxray Tutorial 02 GLUT: Loading the shader program from a file compressed with the Z library. Adding an efficient mouse control to turn the 3D scene. Dr Franck P. Vidal 27 th September 2014 1 Contents

More information

Regression With a Categorical Independent Variable

Regression With a Categorical Independent Variable Regression With a Categorical Independent Variable Lecture 15 March 17, 2005 Applied Regression Analysis Lecture #15-3/17/2005 Slide 1 of 29 Today s Lecture» Today s Lecture» Midterm Note» Example Regression

More information

In this approach, the ground state of the system is found by modeling a diffusion process.

In this approach, the ground state of the system is found by modeling a diffusion process. The Diffusion Monte Carlo (DMC) Method In this approach, the ground state of the system is found by modeling a diffusion process. Diffusion and random walks Consider a random walk on a lattice with spacing

More information

Unit 8: Sequ. ential Circuits

Unit 8: Sequ. ential Circuits CPSC 121: Models of Computation Unit 8: Sequ ential Circuits Based on slides by Patrice Be lleville and Steve Wolfman Pre-Class Learning Goals By the start of class, you s hould be able to Trace the operation

More information

SMT BASICS WS 2017/2018 ( ) LOGIC SATISFIABILITY MODULO THEORIES. Institute for Formal Models and Verification Johannes Kepler Universität Linz

SMT BASICS WS 2017/2018 ( ) LOGIC SATISFIABILITY MODULO THEORIES. Institute for Formal Models and Verification Johannes Kepler Universität Linz LOGIC SATISFIABILITY MODULO THEORIES SMT BASICS WS 2017/2018 (342.208) Armin Biere Martina Seidl biere@jku.at martina.seidl@jku.at Institute for Formal Models and Verification Johannes Kepler Universität

More information

CS100: DISCRETE STRUCTURES

CS100: DISCRETE STRUCTURES 1 CS100: DISCRETE STRUCTURES Computer Science Department Lecture 2: Functions, Sequences, and Sums Ch2.3, Ch2.4 2.3 Function introduction : 2 v Function: task, subroutine, procedure, method, mapping, v

More information

Auto-Tuning Complex Array Layouts for GPUs - Supplemental Material

Auto-Tuning Complex Array Layouts for GPUs - Supplemental Material BIN COUNT EGPGV,. This is the author version of the work. It is posted here by permission of Eurographics for your personal use. Not for redistribution. The definitive version is available at http://diglib.eg.org/.

More information

CS 2336 Discrete Mathematics

CS 2336 Discrete Mathematics CS 2336 Discrete Mathematics Lecture 9 Sets, Functions, and Relations: Part I 1 What is a Set? Set Operations Identities Cardinality of a Set Outline Finite and Infinite Sets Countable and Uncountable

More information

CISC 1100: Structures of Computer Science

CISC 1100: Structures of Computer Science CISC 1100: Structures of Computer Science Chapter 2 Sets and Sequences Fordham University Department of Computer and Information Sciences Fall, 2010 CISC 1100/Fall, 2010/Chapter 2 1 / 49 Outline Sets Basic

More information

Algebraic Dynamic Programming

Algebraic Dynamic Programming Algebraic Dynamic Programming Unit 2.b: Introduction to Bellman s GAP Robert Giegerich 1 (Lecture) Benedikt Löwes (Exercises) Faculty of Technology Bielefeld University http://www.techfak.uni-bielefeld.de/ags/pi/lehre/adp

More information

Linear Programming The Simplex Algorithm: Part II Chapter 5

Linear Programming The Simplex Algorithm: Part II Chapter 5 1 Linear Programming The Simplex Algorithm: Part II Chapter 5 University of Chicago Booth School of Business Kipp Martin October 17, 2017 Outline List of Files Key Concepts Revised Simplex Revised Simplex

More information

Desirable properties of decompositions 1. Decomposition of relational schemes. Desirable properties of decompositions 3

Desirable properties of decompositions 1. Decomposition of relational schemes. Desirable properties of decompositions 3 Desirable properties of decompositions 1 Lossless decompositions A decomposition of the relation scheme R into Decomposition of relational schemes subschemes R 1, R 2,..., R n is lossless if, given tuples

More information

Example problem: The Young Laplace equation

Example problem: The Young Laplace equation Chapter 1 Example problem: The Young Laplace equation This document discusses the finite-element-based solution of the Young Laplace equation, a nonlinear P- DE that determines the static equilibrium shapes

More information

Bloom Filter Redux. CS 270 Combinatorial Algorithms and Data Structures. UC Berkeley, Spring 2011

Bloom Filter Redux. CS 270 Combinatorial Algorithms and Data Structures. UC Berkeley, Spring 2011 Bloom Filter Redux Matthias Vallentin Gene Pang CS 270 Combinatorial Algorithms and Data Structures UC Berkeley, Spring 2011 Inspiration Our background: network security, databases We deal with massive

More information

Computational Physics Lectures: Variational Monte Carlo methods

Computational Physics Lectures: Variational Monte Carlo methods Computational Physics Lectures: Variational Monte Carlo methods Morten Hjorth-Jensen 1,2 Department of Physics, University of Oslo 1 Department of Physics and Astronomy and National Superconducting Cyclotron

More information

ICS141: Discrete Mathematics for Computer Science I

ICS141: Discrete Mathematics for Computer Science I ICS141: Discrete Mathematics for Computer Science I Dept. Information & Computer Sci., Jan Stelovsky based on slides by Dr. Baek and Dr. Still Originals by Dr. M. P. Frank and Dr. J.L. Gross Provided by

More information

Gascoigne 3D High Performance Adaptive Finite Element Toolkit

Gascoigne 3D High Performance Adaptive Finite Element Toolkit Introduction to Gascoigne 3D High Performance Adaptive Finite Element Toolkit Tutorial and manuscript by Thomas Richter thomas.richter@iwr.uni-heidelberg.de April 25, 2014 2 Contents 1 Introduction 5 1.1

More information

Last Update: April 7, 201 0

Last Update: April 7, 201 0 M ath E S W inter Last Update: April 7, Introduction to Partial Differential Equations Disclaimer: his lecture note tries to provide an alternative approach to the material in Sections.. 5 in the textbook.

More information

Monitoring System for ALICE Surface Areas

Monitoring System for ALICE Surface Areas CERN Summer Student Programme Project Report Monitoring System for ALICE Surface Areas Author: Supervisors: Dr. Ombretta Pinazza Peter Matthew Bond September 16, 2016 Contents 1 Introduction 2 2 Development

More information

Constructions on Finite Automata

Constructions on Finite Automata Constructions on Finite Automata Informatics 2A: Lecture 4 Mary Cryan School of Informatics University of Edinburgh mcryan@inf.ed.ac.uk 24 September 2018 1 / 33 Determinization The subset construction

More information

Electrical Circuits Question Paper 4

Electrical Circuits Question Paper 4 Electrical Circuits Question Paper 4 Level IGCSE Subject Physics Exam Board CIE Topic Electricity and Magnetism Sub-Topic Electrical Circuits Paper Type lternative to Practical Booklet Question Paper 4

More information

Lesson 4. Is it a proportion?

Lesson 4. Is it a proportion? Learning Target Ratios and Proportional Relationships Lesson 4 Is it a proportion? Analyze proportional relationships and use them to solve real world and mathematical problems. CCSS.Math.Content.7.RP.A.2

More information

Information System Design IT60105

Information System Design IT60105 Information System Design IT60105 Lecture 8 Use Case Diagrams Lecture #8 What is a use-case diagram? Example: On-line purchase (OLP) system Use-case diagram of OLP system Different components in a use-case

More information

Trip Generation Characteristics of Super Convenience Market Gasoline Pump Stores

Trip Generation Characteristics of Super Convenience Market Gasoline Pump Stores Trip Generation Characteristics of Super Convenience Market Gasoline Pump Stores This article presents the findings of a study that investigated trip generation characteristics of a particular chain of

More information

Static Program Analysis

Static Program Analysis Static Program Analysis Xiangyu Zhang The slides are compiled from Alex Aiken s Michael D. Ernst s Sorin Lerner s A Scary Outline Type-based analysis Data-flow analysis Abstract interpretation Theorem

More information

Regression With a Categorical Independent Variable

Regression With a Categorical Independent Variable Regression With a Independent Variable Lecture 10 November 5, 2008 ERSH 8320 Lecture #10-11/5/2008 Slide 1 of 54 Today s Lecture Today s Lecture Chapter 11: Regression with a single categorical independent

More information

Black-Box Testing Techniques III

Black-Box Testing Techniques III Black-Box Testing Techniques III Software Testing and Verification Lecture 6 Prepared by Stephen M. Thebaut, Ph.D. University of Florida Another Cause-Effect Example: Symbol Table Storage Specification

More information

Turing Machines Part Two

Turing Machines Part Two Turing Machines Part Two Recap from Last Time Our First Turing Machine q acc a start q 0 q 1 a This This is is the the Turing Turing machine s machine s finiteisttiteiconntont. finiteisttiteiconntont.

More information

Computability Theory

Computability Theory CS:4330 Theory of Computation Spring 2018 Computability Theory Decidable Languages Haniel Barbosa Readings for this lecture Chapter 4 of [Sipser 1996], 3rd edition. Section 4.1. Decidable Languages We

More information

UNIT-VIII COMPUTABILITY THEORY

UNIT-VIII COMPUTABILITY THEORY CONTEXT SENSITIVE LANGUAGE UNIT-VIII COMPUTABILITY THEORY A Context Sensitive Grammar is a 4-tuple, G = (N, Σ P, S) where: N Set of non terminal symbols Σ Set of terminal symbols S Start symbol of the

More information

Policy Based Class Design

Policy Based Class Design Policy Based Class Design Policy Based Class Design Christian Gumpert IKTP, TU Dresden 20. June 2011 Christian Gumpert IKTP, TU Dresden 20. June 2011 1 / 15 Policy Based Class Design Outline 1 Policy based

More information

DM545 Linear and Integer Programming. Lecture 7 Revised Simplex Method. Marco Chiarandini

DM545 Linear and Integer Programming. Lecture 7 Revised Simplex Method. Marco Chiarandini DM545 Linear and Integer Programming Lecture 7 Marco Chiarandini Department of Mathematics & Computer Science University of Southern Denmark Outline 1. 2. 2 Motivation Complexity of single pivot operation

More information

PHP Extension Development with C++

PHP Extension Development with C++ PHP Extension Development with C++ Wrapping a C preprocessor API in C++ Florian Sowade August 25, 2012 About Me Florian Sowade Head of embedded software development at crosscan GmbH Currently studying

More information

1 ListElement l e = f i r s t ; / / s t a r t i n g p o i n t 2 while ( l e. next!= n u l l ) 3 { l e = l e. next ; / / next step 4 } Removal

1 ListElement l e = f i r s t ; / / s t a r t i n g p o i n t 2 while ( l e. next!= n u l l ) 3 { l e = l e. next ; / / next step 4 } Removal Präsenzstunden Today In the same room as in the first week Assignment 5 Felix Friedrich, Lars Widmer, Fabian Stutz TA lecture, Informatics II D-BAUG March 18, 2014 HIL E 15.2 15:00-18:00 Timon Gehr (arriving

More information

CS5314 Randomized Algorithms. Lecture 15: Balls, Bins, Random Graphs (Hashing)

CS5314 Randomized Algorithms. Lecture 15: Balls, Bins, Random Graphs (Hashing) CS5314 Randomized Algorithms Lecture 15: Balls, Bins, Random Graphs (Hashing) 1 Objectives Study various hashing schemes Apply balls-and-bins model to analyze their performances 2 Chain Hashing Suppose

More information

Congratulations you're done with CS103 problem sets! Please evaluate this course on Axess!

Congratulations you're done with CS103 problem sets! Please evaluate this course on Axess! The Big Picture Announcements Problem Set 9 due right now. We'll release solutions right now. Congratulations you're done with CS103 problem sets! Please evaluate this course on Axess! Your feedback really

More information

Harvard CS 121 and CSCI E-121 Lecture 14: Turing Machines and the Church Turing Thesis

Harvard CS 121 and CSCI E-121 Lecture 14: Turing Machines and the Church Turing Thesis Harvard CS 121 and CSCI E-121 Lecture 14: Turing Machines and the Church Turing Thesis Harry Lewis October 22, 2013 Reading: Sipser, 3.2, 3.3. The Basic Turing Machine The Basic Turing Machine a a b a

More information

Introduction to Gröbner Bases for Geometric Modeling. Geometric & Solid Modeling 1989 Christoph M. Hoffmann

Introduction to Gröbner Bases for Geometric Modeling. Geometric & Solid Modeling 1989 Christoph M. Hoffmann Introduction to Gröbner Bases for Geometric Modeling Geometric & Solid Modeling 1989 Christoph M. Hoffmann Algebraic Geometry Branch of mathematics. Express geometric facts in algebraic terms in order

More information

CS1800: Hex & Logic. Professor Kevin Gold

CS1800: Hex & Logic. Professor Kevin Gold CS1800: Hex & Logic Professor Kevin Gold Reviewing Last Time: Binary Last time, we saw that arbitrary numbers can be represented in binary. Each place in a binary number stands for a different power of

More information

INF2220: algorithms and data structures Series 1

INF2220: algorithms and data structures Series 1 Universitetet i Oslo Institutt for Informatikk I. Yu, D. Karabeg INF2220: algorithms and data structures Series 1 Topic Function growth & estimation of running time, trees (Exercises with hints for solution)

More information