Overview. Another application of Interfaces: the Strategy Design Pattern. n Java interfaces

Size: px
Start display at page:

Download "Overview. Another application of Interfaces: the Strategy Design Pattern. n Java interfaces"

Transcription

1 Aother applicatio of Iterfaces: the Strategy Desig Patter Erich Gamma, Richard Helm, Ralph Johso, Joh Vlissides, Desig Patters Elemets of Reusable Object- Orieted Software, Addiso-Wesley, 1995, AKA GoF Bruce Eckel, Thikig i Patters with Java, cf. jvo@ualg.pt José Valete de Oliveira 12-1 Overview Java iterfaces q Itroductio q Sitaxe q UML otatio q Multi-iheritace of iterfaces q (Some) Java pre-defied iterfaces q Desig patter: Strategy jvo@ualg.pt José Valete de Oliveira

2 Previously o POO: The Quicksort abstract uchecked ) abstract class Quicksort { private Comparable[] data; public fial void quicksort (Comparable[] d) { data = d; quicksort(0, data.legth-1); Java pre-defied iterfaces Iterface Comparable<T> { /** Aswer a egative iteger if the receiver is lower tha the argumet obj; aswer 0 if both receiver ad obj are equal; aswer a positive iteger is receiver is greater tha obj */ it compareto(t iterface Comparable { /** Aswer a egative iteger if the receiver is lower tha the argumet obj; aswer 0 if both receiver ad obj are equal; aswer a positive iteger is receiver is greater tha obj */ it compareto(object obj); jvo@ualg.pt José Valete de Oliveira

3 Example 3.0 */ class Fractio implemets Comparable<Fractio> { private it um, de; // public it compareto (Fractio f) { double q = (double) um / (double) de ; double fq = (double) f.um /(double) f. de ; retur ((it) Math.sigum(q fq)); jvo@ualg.pt José Valete de Oliveira 11-5 Example public class Mai { public static void mai(strig[] args) { Fractio [] a = {ew Fractio(1, 7), ew Fractio(5, 2), ew Fractio(1, 2) ; ProbQuickSort<Fractio> pqs; pqs = ew ProbQuickSort<Fractio>(); pqs.quicksort(a); for(it i=0; i< a.legth; i++ ) System.out.pritl (a[i]); jvo@ualg.pt José Valete de Oliveira

4 Pre-defied Java iterfaces iterface Cloeable { jvo@ualg.pt José Valete de Oliveira 11-7 Mai methods of abstract superclass Object protected Object cloe() throws CloeNotSupportedExceptio public boolea equals(object obj) protected void fialize() throws Throwable public fial Class<?> getclass() public Strig tostrig() jvo@ualg.pt José Valete de Oliveira

5 Example Iterface IStack { it DEFAUL_SIZE = 10; // class AStack implemets IStack, Cloeable { public AStack() { this(default_size); public Object cloe() { // TODO // jvo@ualg.pt José Valete de Oliveira 11-9 Check poit: where is the error i the class Cliet? class Poit implemets IPoit { private it x, y; public Poit (it a, it b) {setx(a); sety(b); public it getx() {retur x; public it gety() {retur y; public void setx(it a) { assert a>=0; x=a; public void sety(it b) public { assert class b>=0; Cliet x=b; { public it dist(poit p) { public static void mai(strig[] args) { it dx = x p.getx(); IPoit A, B; it dy = y p.gety(); A = ew IPoit(1, 1); retur (it) Math.sqrt(dx*dx+dy*dy); B = ew IPoit(4, 2); System.out.pritl(A.dist(B)); jvo@ualg.pt José Valete de Oliveira

6 The Strategy Desig Pater, or aother commo use for iterfaces José Valete de Oliveira Strategy desig patter, motivatio José Valete de Oliveira

7 Previously o POO: The Quicksort abstract uchecked ) abstract class Quicksort { private Comparable[] data; // Previously o POO: Java pre-defied iterfaces Iterface Comparable<T> { /** Aswer a egative iteger if the receiver is lower tha the argumet obj; aswer 0 if both receiver ad obj are equal; aswer a positive iteger is receiver is greater tha obj */ it compareto(t obj); jvo@ualg.pt José Valete de Oliveira

8 Previously o POO: The Quicksort abstract class public abstract class Quicksort // /** For comparisos, the compareto method from iterface Comparable<T> is used. */ protected fial boolea less(it i, it j) { T di = data.get(i); T dj = data.get(j); retur (di.compareto(dj) < 0); jvo@ualg.pt José Valete de Oliveira Previously: Sortig fractios public class Mai { public static void mai(strig[] args) { Fractio [] a = {ew Fractio(1, 7), ew Fractio(5, 2), ew Fractio(1, 2) ; ProbQuickSort<Fractio> pqs; pqs = ew ProbQuickSort<Fractio>(); pqs.quicksort(a); for(it i=0; i< a.legth; i++ ) System.out.pritl (a[i]); jvo@ualg.pt José Valete de Oliveira

9 Previously: Fractio implemets Comparable<T> class Fractio implemets Comparable<Fractio> { private it um, de; // public it compareto (Fractio f) { double q = (double) um / (double) de ; double fq = (double) f.um /(double) f. de ; retur ((it) Math.sigum(q fq)); jvo@ualg.pt José Valete de Oliveira Strategy java example public abstract class Quicksort // protected fial boolea less(it i, it j) { T di = data.get(i); T dj = data.get(j); retur (di.compareto(dj) < 0); iterface Comparable<E> { it compareto(e e); class Fractio implemets Comparable<Fractio> { // public it compareto (Fractio f) { double q = (double) um / (double) de ; double fq = (double) f.um /(double) f. de ; retur ((it) Math.ceil(q fq)); jvo@ualg.pt José Valete de Oliveira

10 The same example i UML {abstract Quicksort # less(it i, it j) <<iterface>> Comparable<E> + compareto(e e) Fractio + compareto (Fractio f) jvo@ualg.pt José Valete de Oliveira Strategy itet Defie a family of algorithms, ecapsulate each oe, ad make them iterchageable. Capture the abstractio i a iterface that ca be implemeted by idepedet classes. jvo@ualg.pt José Valete de Oliveira

11 Strategy usage Use this patter whe a object should be parametrized with oe of several algorithms that ca be represeted by a sigle iterface Strategy allows oe of a family of algorithms to be selected o-the-fly at rutime. jvo@ualg.pt José Valete de Oliveira Strategy - structure jvo@ualg.pt José Valete de Oliveira

12 The same example agai {abstract Quicksort # less(it i, it j) <<iterface>> Comparable<E> + compareto(e e) Fractio + compareto (Fractio f) jvo@ualg.pt José Valete de Oliveira Strategy Brief discussio The usage of the Strategy Desig patter avoids the employmet of coditioal cotrol structures that would make code hard to read ad to maitai Cliet eeds to be aware of the differet available strategies I some case, both Strategy ad Template Methods ca be used Typically, Strategy is more flexible while Template method is more eficiet jvo@ualg.pt José Valete de Oliveira

13 Program to a iterface ot for a implemetatio jvo@ualg.pt José Valete de Oliveira Check poit: We foud the code i this ad i the ext slide i the et public class Mai { public static void mai(strig [] a) throws FileNotFoudExceptio { Strig s = "a Strig"; FileDataHadler.write("test", s, "html"); FileDataHadler.write("test", s, "xml"); jvo@ualg.pt José Valete de Oliveira

14 Check poit: how to improve the Quality of this code? class FileDataHadler { public static void write(strig fileame, Strig text, Strig selector) throws FileNotFoudExceptio { fileame += '.' + selector; PritWriter out = ew PritWriter(ew File(fileame).getAbsoluteFile()); if (selector.comparetoigorecase("html")==0) out.prit("<div><h1> " + text + "</h1></div>"); else if (selector.comparetoigorecase("xml")==0) out.prit("<?xml versio="+'"'+"1.0"+'"'+" ecodig="+'"'+"iso "+'"'+"?> <data>" + text + "</data>"); else { System.err.pritl("Ivalid Selector"); System.exit(1); jvo@ualg.pt José Valete de Oliveira Recall the structure of Strategy jvo@ualg.pt José Valete de Oliveira

15 Applyig the Strategy Desig Patter: 1 Defie the Strategy Iterface iterface IDisplayCotets{ Strig display(strig s); Strig fileextesio(); jvo@ualg.pt José Valete de Oliveira Applyig the Strategy Desig Patter: 2 Defie the Cotext class class FileDataHadler { public static void write(strig fileame, Strig text, IDisplayCotets i) throws FileNotFoudExceptio { fileame += i.fileextesio(); PritWriter out = ew PritWriter(ew File(fileame).getAbsoluteFile()); out.prit(i.display(text)); out.close(); jvo@ualg.pt José Valete de Oliveira

16 The ew FileDataHadler is ow much more clear tha the origial class FileDataHadler { public static void write(strig fileame, Strig text, Strig selector) throws FileNotFoudExceptio { fileame += '.' + selector; PritWriter out = ew PritWriter(ew File(fileame).getAbsoluteFile()); if (selector.comparetoigorecase("html")==0) out.prit("<div><h1> " + text + "</h1></div>"); else if (selector.comparetoigorecase("xml")==0) out.prit("<?xml versio="+'"'+"1.0"+'"'+" ecodig="+'"'+"iso "+'"'+"?> <data>" + text + "</data>"); else { System.err.pritl("Ivalid Selector"); System.exit(1); jvo@ualg.pt José Valete de Oliveira Applyig the Strategy Desig Patter: 3 Write the cocrete class that implemets the Strategy iterface class StrategyHTML implemets IDisplayCotets { // retur cotets of data file as HTML public Strig display(strig s){ retur "<div><h1>cotets of data file, formatted as HTML</h1><p>" + s + "</p></div>"; public Strig fileextesio() { retur ".html"; // defie 'StrategyXML' class class StrategyXML implemets IDisplayCotets { // retur cotets of data file as XML public Strig display(strig s) { retur "<?xml versio="+'"'+"1.0"+'"'+" ecodig="+'"'+"iso "+'"'+"?> <data><filedata>" + s + "</filedata></data>"; public Strig fileextesio() { retur ".xml"; jvo@ualg.pt José Valete de Oliveira

17 Applyig the Strategy Desig Patter: 4 Let the cliet decide o the strategy to use. public class Mai { public static void mai(strig [] a) throws FileNotFoudExceptio { Strig s = astrig"; IDisplayCotets d = ew StrategyHTML(); FileDataHadler.write("test", s, d); d = ew StrategyXML(); FileDataHadler.write("test", s, d); jvo@ualg.pt José Valete de Oliveira Summary Java iterfaces q A itroductio q Sitaxe q UML otatio q Multi-iheritace of iterfaces q (Some) Java pre-defied iterfaces q Desig patter: Strategy jvo@ualg.pt José Valete de Oliveira

18 Namespaces ad Java Packages José Valete de Oliveira Overview Namespaces Java Packages q Usig ad resolvig packages Packages i UML q q Notatio Relatioships jvo@ualg.pt José Valete de Oliveira

19 Namespaces A ame space is ay laguage costruct that cotais defiitios ad a regio of the program where those defiitios apply. A ame space has a ame that ca be used to access the defiitios from outside of the costruct. jvo@ualg.pt José Valete de Oliveira Why amespaces? To use simple, easy to remember ames i differet cotexts To miimize chaces of ame clashes whe usig multiple libraries To keep mai amespace clea jvo@ualg.pt José Valete de Oliveira

20 Package A package is a groupig of related elemets providig access protectio ad ame space maagemet. The elemets ca be classes, iterfaces, eumeratios, aotatio types, or aother packages. jvo@ualg.pt José Valete de Oliveira Java Packages Orgaize classes i libraries Structure ame space for classes Restrict visibility Ca be ested Some of the core packages of Java: q q q q q java.lag java.util java.io java.et java.applet jvo@ualg.pt José Valete de Oliveira

21 Usig ames defied withi a package 0.0 */ class Mai { public static void mai(strig [] args) { java.util.scaer s = ew java.util.scaer(system.i); it = s.extit(); // 1.0 */ import java.util.scaer; class Mai { public static void mai(strig [] args) { Scaer s = ew Scaer(System.i); it = s.extit(); //. jvo@ualg.pt José Valete de Oliveira Usig ames defied withi a package 1.1 */ import java.util.*; class Mai { public static void mai(strig [] args) { Scaer s = ew Scaer(System.i); it = s.extit(); List<Fractio> = ew ArrayList<Fractio>(); //. jvo@ualg.pt José Valete de Oliveira

22 Uique package amig scheme A class programmed at the domai deei.fct.ualg.pt should be defied i the package pt.ualg.fct.deei i.e., the domai is reversed ad subdomais become packages) This guaratees that o other orgaizatio will create a class whose ame coflicts with classes developed at deei.fct.ualg.pt. jvo@ualg.pt José Valete de Oliveira Defiig packages // File: Poit.java package pt.ualg.fct.deei.graphiceditor; public class Poit { /* */ Covetio: package ames start with a lower case class A { /* */ class B { /* */ jvo@ualg.pt José Valete de Oliveira

23 Defiig packages // File: File: Rectagle.java package pt.ualg.fct.deei.graphiceditor; public class Rectagle exteds Polygo { // import pt.ualg.fct.deei.graphiceditor.poit; public class Mai { public static void mai(strig[] args) { Poit p = ew Poit(); // jvo@ualg.pt José Valete de Oliveira Recall: cotets of a.java file 1. Optioally, oe package directive; 2. Zero or more import directives; 3. Oe or more class / iterface defiitios, oe of them beig public ad with the same ame of the file jvo@ualg.pt José Valete de Oliveira

24 Package compilig Package ames map directly to subdirectories Whe compiled, the package structure is physically represeted usig a directory tree: q The.class file for the class pt.ualg.fct.deei.graphiceditor.poit will be saved at: pt/ualg/fct/deei/graphiceditor/poit.class jvo@ualg.pt José Valete de Oliveira Resolvig packages i rutime Due to packages,.class files ca ow exist withi a large umber of directories For performace reasos, the ClassLoader (from JVM) must have a quick way of resolvig a fully qualified class referece to.class file. The ClassLoader uses a eviromet variable called CLASSPATH to fid the directories cotaiig.class files jvo@ualg.pt José Valete de Oliveira

25 Resolvig packages i rutime My classpath.;c:\programas\jade\lib\jade.jar;c:\programas\jade\lib\jadetools.jar;c:\programas\jade\iiop.jar;c:\programas\jade\lib\http.jar;c:\ Programas\Jade\\lib\commos-codec\commoscodec- 1.3.jar;c:\programas\jadex- 0.96\lib\jadex_rt.jar;c:\programas\jadex-0.96\lib\jibx- ru.jar;c:\programas\jadex-0.96\ib\xpp3.jar;c:\programas\jadex- 0.96\lib\uggets.jar;c:\programas\jadex- 0.96\lib\jaio.jar;c:\programas\jadex- 0.96\lib\jadex_stadaloe.jar;c:\programas\jadex- 0.96\lib\jadex_tools.jar;c:\programas\jadex- 0.96\lib\GraphLayout.jar;c:\programas\jadex-0.96\lib\jhall.jar jvo@ualg.pt José Valete de Oliveira UML otatio for packages 25

26 UML otatio for packages José Valete de Oliveira UML packages: relatioships Package A Package B «imports» Package C jvo@ualg.pt José Valete de Oliveira

27 UML packages: importig José Valete de Oliveira To take away Namespaces Java Packages q Usig ad resolvig packages Packages i UML q q Notatio Relatioships jvo@ualg.pt José Valete de Oliveira

Bruce Eckel, Thinking in Patterns with Java, cf. José Valente de Oliveira 10-1

Bruce Eckel, Thinking in Patterns with Java, cf.   José Valente de Oliveira 10-1 The desig patter Template Method Erich Gamma, Richard Helm, Ralph Johso, Joh Vlissides, Desig Patters Elemets of Reusable Object-Orieted Software, Addiso-Wesley, 1995, AKA GoF Bruce Eckel, Thikig i Patters

More information

Classes and Objects. Again: Distance between points within the first quadrant. José Valente de Oliveira 4-1

Classes and Objects. Again: Distance between points within the first quadrant. José Valente de Oliveira 4-1 Classes ad Objects jvo@ualg.pt José Valete de Oliveira 4-1 Agai: Distace betwee poits withi the first quadrat Sample iput Sample output 1 1 3 4 2 jvo@ualg.pt José Valete de Oliveira 4-2 1 The simplest

More information

JCF: case studies. Bruce Eckel, Thinking in Java, 4th edition, PrenticeHall, New Jersey, cf.

JCF: case studies. Bruce Eckel, Thinking in Java, 4th edition, PrenticeHall, New Jersey, cf. JCF: case studies Bruce Eckel, Thikig i Java, 4th editio, PreticeHall, New Jersey, cf. http://midview.et/books/tij4 jvo@ualg.pt José Valete de Oliveira 20-1 CS1: From real to fractio How to covert a real

More information

Java net programming II

Java net programming II Java et programmig II https://docs.oracle.com/javase/tutorial/etworkig/sockets/ Overview The problem Basic backgroud: TCP/IP, ports, Cliet/Server, sockets Commuicatio with sockets java.et (overview) Simple

More information

Interfaces Java. Overview. n Java interfaces. q Introduction. q Sintaxe. q UML notation. q Multi-inheritance of interfaces

Interfaces Java. Overview. n Java interfaces. q Introduction. q Sintaxe. q UML notation. q Multi-inheritance of interfaces Interfaces Java jvo@ualg.pt José Valente de Oliveira 11-1 Overview n Java interfaces q Introduction q Sintaxe q UML notation q Multi-inheritance of interfaces q (Some) Java pre-defined interfaces q Design

More information

Exceptions. Your computer takes exception. The Exception Class. Causes of Exceptions

Exceptions. Your computer takes exception. The Exception Class. Causes of Exceptions Your computer takes exceptio s s are errors i the logic of a program (ru-time errors). Examples: i thread mai java.io.filenotfoud: studet.txt (The system caot fid the file specified.) i thread mai java.lag.nullpoiter:

More information

University of Waterloo Department of Electrical and Computer Engineering ECE 250 Algorithms and Data Structures

University of Waterloo Department of Electrical and Computer Engineering ECE 250 Algorithms and Data Structures Uiversity of Waterloo Departmet of Electrical ad Computer Egieerig ECE 250 Algorithms ad Data Structures Midterm Examiatio ( pages) Istructor: Douglas Harder February 7, 2004 7:30-9:00 Name (last, first)

More information

Streams. Overview. The notion of stream Java I/O streamhierarchy Files, and file access using streams Serialization Sockets

Streams. Overview. The notion of stream Java I/O streamhierarchy Files, and file access using streams Serialization Sockets Streams Bruce Eckel, Thikig i Java, 4th editio, PreticeHall, New Jersey, cf. http://midview.et/books/tij4 jvo@ualg.pt José Valete de Oliveira 16-1 Overview The otio of stream Java I/O streamhierarchy Files,

More information

Τεχνολογία Λογισμικού

Τεχνολογία Λογισμικού ΕΘΝΙΚΟ ΜΕΤΣΟΒΙΟ ΠΟΛΥΤΕΧΝΕΙΟ Σχολή Ηλεκτρολόγων Μηχανικών και Μηχανικών Υπολογιστών Τεχνολογία Λογισμικού, 7ο/9ο εξάμηνο 2018-2019 Τεχνολογία Λογισμικού Ν.Παπασπύρου, Αν.Καθ. ΣΗΜΜΥ, ickie@softlab.tua,gr

More information

Goals of the Lecture UML Implementation Diagrams

Goals of the Lecture UML Implementation Diagrams Goals of the Lecture UML Implemetatio Diagrams Object-Orieted Aalysis ad Desig - Fall 1998 Preset UML Diagrams useful for implemetatio Provide examples Next Lecture Ð A variety of topics o mappig from

More information

Chapter 5. Functions for All Subtasks. Copyright 2015 Pearson Education, Ltd.. All rights reserved.

Chapter 5. Functions for All Subtasks. Copyright 2015 Pearson Education, Ltd.. All rights reserved. Chapter 5 Fuctios for All Subtasks Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 5.1 void Fuctios 5.2 Call-By-Referece Parameters 5.3 Usig Procedural Abstractio 5.4 Testig ad Debuggig

More information

Chapter 11. Friends, Overloaded Operators, and Arrays in Classes. Copyright 2014 Pearson Addison-Wesley. All rights reserved.

Chapter 11. Friends, Overloaded Operators, and Arrays in Classes. Copyright 2014 Pearson Addison-Wesley. All rights reserved. Chapter 11 Frieds, Overloaded Operators, ad Arrays i Classes Copyright 2014 Pearso Addiso-Wesley. All rights reserved. Overview 11.1 Fried Fuctios 11.2 Overloadig Operators 11.3 Arrays ad Classes 11.4

More information

10/23/18. File class in Java. Scanner reminder. Files. Opening a file for reading. Scanner reminder. File Input and Output

10/23/18. File class in Java. Scanner reminder. Files. Opening a file for reading. Scanner reminder. File Input and Output File class i Java File Iput ad Output TOPICS File Iput Exceptio Hadlig File Output Programmers refer to iput/output as "I/O". The File class represets files as objects. The class is defied i the java.io

More information

COSC 1P03. Ch 7 Recursion. Introduction to Data Structures 8.1

COSC 1P03. Ch 7 Recursion. Introduction to Data Structures 8.1 COSC 1P03 Ch 7 Recursio Itroductio to Data Structures 8.1 COSC 1P03 Recursio Recursio I Mathematics factorial Fiboacci umbers defie ifiite set with fiite defiitio I Computer Sciece sytax rules fiite defiitio,

More information

Recursion. Computer Science S-111 Harvard University David G. Sullivan, Ph.D. Review: Method Frames

Recursion. Computer Science S-111 Harvard University David G. Sullivan, Ph.D. Review: Method Frames Uit 4, Part 3 Recursio Computer Sciece S-111 Harvard Uiversity David G. Sulliva, Ph.D. Review: Method Frames Whe you make a method call, the Java rutime sets aside a block of memory kow as the frame of

More information

Threads and Concurrency in Java: Part 1

Threads and Concurrency in Java: Part 1 Cocurrecy Threads ad Cocurrecy i Java: Part 1 What every computer egieer eeds to kow about cocurrecy: Cocurrecy is to utraied programmers as matches are to small childre. It is all too easy to get bured.

More information

Threads and Concurrency in Java: Part 1

Threads and Concurrency in Java: Part 1 Threads ad Cocurrecy i Java: Part 1 1 Cocurrecy What every computer egieer eeds to kow about cocurrecy: Cocurrecy is to utraied programmers as matches are to small childre. It is all too easy to get bured.

More information

Chapter 9. Pointers and Dynamic Arrays. Copyright 2015 Pearson Education, Ltd.. All rights reserved.

Chapter 9. Pointers and Dynamic Arrays. Copyright 2015 Pearson Education, Ltd.. All rights reserved. Chapter 9 Poiters ad Dyamic Arrays Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 9.1 Poiters 9.2 Dyamic Arrays Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Slide 9-3

More information

Today s objectives. CSE401: Introduction to Compiler Construction. What is a compiler? Administrative Details. Why study compilers?

Today s objectives. CSE401: Introduction to Compiler Construction. What is a compiler? Administrative Details. Why study compilers? CSE401: Itroductio to Compiler Costructio Larry Ruzzo Sprig 2004 Today s objectives Admiistrative details Defie compilers ad why we study them Defie the high-level structure of compilers Associate specific

More information

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe Copyright 2016 Ramez Elmasri ad Shamkat B. Navathe CHAPTER 26 Ehaced Data Models: Itroductio to Active, Temporal, Spatial, Multimedia, ad Deductive Databases Copyright 2016 Ramez Elmasri ad Shamkat B.

More information

Exercise Set: Implementing an Object-Oriented Design

Exercise Set: Implementing an Object-Oriented Design Exercise Set: Implemetig a Object-Orieted Desig I this exercise set, we have marked questios we thik are harder tha others with a [ ]. We have also marked questios for which solutios are provided at the

More information

Schema for the DCE Security Registry Server

Schema for the DCE Security Registry Server Schema for the Security egistry Server Versio Date: 0/20/00 For questios or commets cocerig this documet, sed a email ote to dce-ldap@opegroup.org or call Doa Skibbie at 52 838-3896. . Itroductio...3 2.

More information

Structuring Redundancy for Fault Tolerance. CSE 598D: Fault Tolerant Software

Structuring Redundancy for Fault Tolerance. CSE 598D: Fault Tolerant Software Structurig Redudacy for Fault Tolerace CSE 598D: Fault Tolerat Software What do we wat to achieve? Versios Damage Assessmet Versio 1 Error Detectio Iputs Versio 2 Voter Outputs State Restoratio Cotiued

More information

Chapter 10. Defining Classes. Copyright 2015 Pearson Education, Ltd.. All rights reserved.

Chapter 10. Defining Classes. Copyright 2015 Pearson Education, Ltd.. All rights reserved. Chapter 10 Defiig Classes Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 10.1 Structures 10.2 Classes 10.3 Abstract Data Types 10.4 Itroductio to Iheritace Copyright 2015 Pearso Educatio,

More information

Priority Queues. Binary Heaps

Priority Queues. Binary Heaps Priority Queues Biary Heaps Priority Queues Priority: some property of a object that allows it to be prioritized with respect to other objects of the same type Mi Priority Queue: homogeeous collectio of

More information

! Given the following Structure: ! We can define a pointer to a structure. ! Now studentptr points to the s1 structure.

! Given the following Structure: ! We can define a pointer to a structure. ! Now studentptr points to the s1 structure. Liked Lists Uit 5 Sectios 11.9 & 18.1-2 CS 2308 Fall 2018 Jill Seama 11.9: Poiters to Structures! Give the followig Structure: struct Studet { strig ame; // Studet s ame it idnum; // Studet ID umber it

More information

Computers and Scientific Thinking

Computers and Scientific Thinking Computers ad Scietific Thikig David Reed, Creighto Uiversity Chapter 15 JavaScript Strigs 1 Strigs as Objects so far, your iteractive Web pages have maipulated strigs i simple ways use text box to iput

More information

n We have discussed classes in previous lectures n Here, we discuss design of classes n Library design considerations

n We have discussed classes in previous lectures n Here, we discuss design of classes n Library design considerations Chapter 14 Graph class desig Bjare Stroustrup Abstract We have discussed classes i previous lectures Here, we discuss desig of classes Library desig cosideratios Class hierarchies (object-orieted programmig)

More information

Lecture Notes 6 Introduction to algorithm analysis CSS 501 Data Structures and Object-Oriented Programming

Lecture Notes 6 Introduction to algorithm analysis CSS 501 Data Structures and Object-Oriented Programming Lecture Notes 6 Itroductio to algorithm aalysis CSS 501 Data Structures ad Object-Orieted Programmig Readig for this lecture: Carrao, Chapter 10 To be covered i this lecture: Itroductio to algorithm aalysis

More information

Chapter 1. Introduction to Computers and C++ Programming. Copyright 2015 Pearson Education, Ltd.. All rights reserved.

Chapter 1. Introduction to Computers and C++ Programming. Copyright 2015 Pearson Education, Ltd.. All rights reserved. Chapter 1 Itroductio to Computers ad C++ Programmig Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 1.1 Computer Systems 1.2 Programmig ad Problem Solvig 1.3 Itroductio to C++ 1.4 Testig

More information

Basic allocator mechanisms The course that gives CMU its Zip! Memory Management II: Dynamic Storage Allocation Mar 6, 2000.

Basic allocator mechanisms The course that gives CMU its Zip! Memory Management II: Dynamic Storage Allocation Mar 6, 2000. 5-23 The course that gives CM its Zip Memory Maagemet II: Dyamic Storage Allocatio Mar 6, 2000 Topics Segregated lists Buddy system Garbage collectio Mark ad Sweep Copyig eferece coutig Basic allocator

More information

CIS 121 Data Structures and Algorithms with Java Spring Stacks, Queues, and Heaps Monday, February 18 / Tuesday, February 19

CIS 121 Data Structures and Algorithms with Java Spring Stacks, Queues, and Heaps Monday, February 18 / Tuesday, February 19 CIS Data Structures ad Algorithms with Java Sprig 09 Stacks, Queues, ad Heaps Moday, February 8 / Tuesday, February 9 Stacks ad Queues Recall the stack ad queue ADTs (abstract data types from lecture.

More information

From last week. Lecture 5. Outline. Principles of programming languages

From last week. Lecture 5. Outline. Principles of programming languages Priciples of programmig laguages From last week Lecture 5 http://few.vu.l/~silvis/ppl/2007 Natalia Silvis-Cividjia e-mail: silvis@few.vu.l ML has o assigmet. Explai how to access a old bidig? Is & for

More information

Topics. Instance object. Instance object. Fundamentals of OT. Object notation. How do objects collaborate? Pearson Education 2007 Appendix (RASD 3/e)

Topics. Instance object. Instance object. Fundamentals of OT. Object notation. How do objects collaborate? Pearson Education 2007 Appendix (RASD 3/e) Appedix (RASD 3/e) MACIASZEK, L.A. (2007): Requiremets Aalysis ad System Desig, 3 rd ed. Addiso Wesley, Harlow Eglad ISBN 978-0-321-44036-5 Appedix Fudametals of Object Techology Pearso Educatio Limited

More information

Running Time. Analysis of Algorithms. Experimental Studies. Limitations of Experiments

Running Time. Analysis of Algorithms. Experimental Studies. Limitations of Experiments Ruig Time Aalysis of Algorithms Iput Algorithm Output A algorithm is a step-by-step procedure for solvig a problem i a fiite amout of time. Most algorithms trasform iput objects ito output objects. The

More information

CSE 417: Algorithms and Computational Complexity

CSE 417: Algorithms and Computational Complexity Time CSE 47: Algorithms ad Computatioal Readig assigmet Read Chapter of The ALGORITHM Desig Maual Aalysis & Sortig Autum 00 Paul Beame aalysis Problem size Worst-case complexity: max # steps algorithm

More information

Java Inheritance. Class ADT (Abstract Data Type) Interface. Classes implement the concept of ADT: Interfaces define interaction contracts: Rui Moreira

Java Inheritance. Class ADT (Abstract Data Type) Interface. Classes implement the concept of ADT: Interfaces define interaction contracts: Rui Moreira Java Iheritace Rui Moreira Class ADT (Abstract Data Type) Classes implemet the cocept of ADT: Provide a coheret represetatio for the declaratio of structured data types ad also the code for maipulatig

More information

CIS 121. Introduction to Trees

CIS 121. Introduction to Trees CIS 121 Itroductio to Trees 1 Tree ADT Tree defiitio q A tree is a set of odes which may be empty q If ot empty, the there is a distiguished ode r, called root ad zero or more o-empty subtrees T 1, T 2,

More information

Running Time ( 3.1) Analysis of Algorithms. Experimental Studies. Limitations of Experiments

Running Time ( 3.1) Analysis of Algorithms. Experimental Studies. Limitations of Experiments Ruig Time ( 3.1) Aalysis of Algorithms Iput Algorithm Output A algorithm is a step- by- step procedure for solvig a problem i a fiite amout of time. Most algorithms trasform iput objects ito output objects.

More information

Analysis of Algorithms

Analysis of Algorithms Aalysis of Algorithms Iput Algorithm Output A algorithm is a step-by-step procedure for solvig a problem i a fiite amout of time. Ruig Time Most algorithms trasform iput objects ito output objects. The

More information

Chapter 8. Strings and Vectors. Copyright 2014 Pearson Addison-Wesley. All rights reserved.

Chapter 8. Strings and Vectors. Copyright 2014 Pearson Addison-Wesley. All rights reserved. Chapter 8 Strigs ad Vectors Overview 8.1 A Array Type for Strigs 8.2 The Stadard strig Class 8.3 Vectors Slide 8-3 8.1 A Array Type for Strigs A Array Type for Strigs C-strigs ca be used to represet strigs

More information

CS200: Hash Tables. Prichard Ch CS200 - Hash Tables 1

CS200: Hash Tables. Prichard Ch CS200 - Hash Tables 1 CS200: Hash Tables Prichard Ch. 13.2 CS200 - Hash Tables 1 Table Implemetatios: average cases Search Add Remove Sorted array-based Usorted array-based Balaced Search Trees O(log ) O() O() O() O(1) O()

More information

Python Programming: An Introduction to Computer Science

Python Programming: An Introduction to Computer Science Pytho Programmig: A Itroductio to Computer Sciece Chapter 6 Defiig Fuctios Pytho Programmig, 2/e 1 Objectives To uderstad why programmers divide programs up ito sets of cooperatig fuctios. To be able to

More information

Chapter 8. Strings and Vectors. Copyright 2015 Pearson Education, Ltd.. All rights reserved.

Chapter 8. Strings and Vectors. Copyright 2015 Pearson Education, Ltd.. All rights reserved. Chapter 8 Strigs ad Vectors Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 8.1 A Array Type for Strigs 8.2 The Stadard strig Class 8.3 Vectors Copyright 2015 Pearso Educatio, Ltd..

More information

COP4020 Programming Languages. Functional Programming Prof. Robert van Engelen

COP4020 Programming Languages. Functional Programming Prof. Robert van Engelen COP4020 Programmig Laguages Fuctioal Programmig Prof. Robert va Egele Overview What is fuctioal programmig? Historical origis of fuctioal programmig Fuctioal programmig today Cocepts of fuctioal programmig

More information

Java Expressions & Flow Control

Java Expressions & Flow Control Java Expressios & Flow Cotrol Rui Moreira Expressio Separators:. [ ] ( ), ; Dot used as decimal separator or to access attributes ad methods double d = 2.6; Poto poto = ew Poto(2, 3); it i = poto.x; it

More information

CS211 Fall 2003 Prelim 2 Solutions and Grading Guide

CS211 Fall 2003 Prelim 2 Solutions and Grading Guide CS11 Fall 003 Prelim Solutios ad Gradig Guide Problem 1: (a) obj = obj1; ILLEGAL because type of referece must always be a supertype of type of object (b) obj3 = obj1; ILLEGAL because type of referece

More information

Pseudocode ( 1.1) Analysis of Algorithms. Primitive Operations. Pseudocode Details. Running Time ( 1.1) Estimating performance

Pseudocode ( 1.1) Analysis of Algorithms. Primitive Operations. Pseudocode Details. Running Time ( 1.1) Estimating performance Aalysis of Algorithms Iput Algorithm Output A algorithm is a step-by-step procedure for solvig a problem i a fiite amout of time. Pseudocode ( 1.1) High-level descriptio of a algorithm More structured

More information

Data Structures and Algorithms. Analysis of Algorithms

Data Structures and Algorithms. Analysis of Algorithms Data Structures ad Algorithms Aalysis of Algorithms Outlie Ruig time Pseudo-code Big-oh otatio Big-theta otatio Big-omega otatio Asymptotic algorithm aalysis Aalysis of Algorithms Iput Algorithm Output

More information

Outline and Reading. Analysis of Algorithms. Running Time. Experimental Studies. Limitations of Experiments. Theoretical Analysis

Outline and Reading. Analysis of Algorithms. Running Time. Experimental Studies. Limitations of Experiments. Theoretical Analysis Outlie ad Readig Aalysis of Algorithms Iput Algorithm Output Ruig time ( 3.) Pseudo-code ( 3.2) Coutig primitive operatios ( 3.3-3.) Asymptotic otatio ( 3.6) Asymptotic aalysis ( 3.7) Case study Aalysis

More information

Chapter 4. Procedural Abstraction and Functions That Return a Value. Copyright 2015 Pearson Education, Ltd.. All rights reserved.

Chapter 4. Procedural Abstraction and Functions That Return a Value. Copyright 2015 Pearson Education, Ltd.. All rights reserved. Chapter 4 Procedural Abstractio ad Fuctios That Retur a Value Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 4.1 Top-Dow Desig 4.2 Predefied Fuctios 4.3 Programmer-Defied Fuctios 4.4

More information

Introduction to Pattern Oriented Analysis and Design (POAD) Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical Engineering, WVU

Introduction to Pattern Oriented Analysis and Design (POAD) Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical Engineering, WVU Itroductio to Patter Orieted Aalysis ad Desig (POAD) Istructor: Dr. Hay H. Ammar Dept. of Computer Sciece ad Electrical Egieerig, WVU Outlie Review of Desig Patters The Lifecycle of a Patter Examples of

More information

CS 11 C track: lecture 1

CS 11 C track: lecture 1 CS 11 C track: lecture 1 Prelimiaries Need a CMS cluster accout http://acctreq.cms.caltech.edu/cgi-bi/request.cgi Need to kow UNIX IMSS tutorial liked from track home page Track home page: http://courses.cms.caltech.edu/courses/cs11/material

More information

Morgan Kaufmann Publishers 26 February, COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface. Chapter 5.

Morgan Kaufmann Publishers 26 February, COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface. Chapter 5. Morga Kaufma Publishers 26 February, 208 COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Iterface 5 th Editio Chapter 5 Virtual Memory Review: The Memory Hierarchy Take advatage of the priciple

More information

CS 111: Program Design I Lecture 19: Networks, the Web, and getting text from the Web in Python

CS 111: Program Design I Lecture 19: Networks, the Web, and getting text from the Web in Python CS 111: Program Desig I Lecture 19: Networks, the Web, ad gettig text from the Web i Pytho Robert H. Sloa & Richard Warer Uiversity of Illiois at Chicago April 3, 2018 Goals Lear about Iteret Lear about

More information

9.1. Sequences and Series. Sequences. What you should learn. Why you should learn it. Definition of Sequence

9.1. Sequences and Series. Sequences. What you should learn. Why you should learn it. Definition of Sequence _9.qxd // : AM Page Chapter 9 Sequeces, Series, ad Probability 9. Sequeces ad Series What you should lear Use sequece otatio to write the terms of sequeces. Use factorial otatio. Use summatio otatio to

More information

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe Copyright 2016 Ramez Elmasri ad Shamkat B. Navathe CHAPTER 18 Strategies for Query Processig Copyright 2016 Ramez Elmasri ad Shamkat B. Navathe Itroductio DBMS techiques to process a query Scaer idetifies

More information

Avid Interplay Bundle

Avid Interplay Bundle Avid Iterplay Budle Versio 2.5 Cofigurator ReadMe Overview This documet provides a overview of Iterplay Budle v2.5 ad describes how to ru the Iterplay Budle cofiguratio tool. Iterplay Budle v2.5 refers

More information

BEA Tuxedo. Using the CORBA Name Service

BEA Tuxedo. Using the CORBA Name Service BEA Tuxedo Usig the CORBA Name Service BEA Tuxedo Release 8.0 Documet Editio 8.0 Jue 2001 Copyright Copyright 2001 BEA Systems, Ic. All Rights Reserved. Restricted Rights Leged This software ad documetatio

More information

An introduction to Java II

An introduction to Java II An introduction to Java II Bruce Eckel, Thinking in Java, 4th edition, PrenticeHall, New Jersey, cf. http://mindview.net/books/tij4 jvo@ualg.pt José Valente de Oliveira 4-1 Java: Generalities A little

More information

Package RcppRoll. December 22, 2014

Package RcppRoll. December 22, 2014 Type Package Package RcppRoll December 22, 2014 Title Fast rollig fuctios through Rcpp ad RcppArmadillo Versio 0.1.0 Date 2013-01-10 Author Kevi Ushey Maitaier Kevi Ushey RcppRoll

More information

Lecture 5. Counting Sort / Radix Sort

Lecture 5. Counting Sort / Radix Sort Lecture 5. Coutig Sort / Radix Sort T. H. Corme, C. E. Leiserso ad R. L. Rivest Itroductio to Algorithms, 3rd Editio, MIT Press, 2009 Sugkyukwa Uiversity Hyuseug Choo choo@skku.edu Copyright 2000-2018

More information

Linked Lists 11/16/18. Preliminaries. Java References. Objects and references. Self references. Linking self-referential nodes

Linked Lists 11/16/18. Preliminaries. Java References. Objects and references. Self references. Linking self-referential nodes Prelimiaries Liked Lists public class StrageObject { Strig ame; StrageObject other; Arrays are ot always the optimal data structure: A array has fixed size eeds to be copied to expad its capacity Addig

More information

Abstract Data Types (ADTs) Stacks. The Stack ADT ( 4.2) Stack Interface in Java

Abstract Data Types (ADTs) Stacks. The Stack ADT ( 4.2) Stack Interface in Java Abstract Data Types (ADTs) tacks A abstract data type (ADT) is a abstractio of a data structure A ADT specifies: Data stored Operatios o the data Error coditios associated with operatios Example: ADT modelig

More information

Examples and Applications of Binary Search

Examples and Applications of Binary Search Toy Gog ITEE Uiersity of Queeslad I the secod lecture last week we studied the biary search algorithm that soles the problem of determiig if a particular alue appears i a sorted list of iteger or ot. We

More information

n The C++ template facility provides the ability to define n A generic facility allows code to be written once then

n The C++ template facility provides the ability to define n A generic facility allows code to be written once then UCLA PIC 10 B Problem Solvig usig C++ Programmig Ivo Diov, Asst. Prof. i Mathematics, Neurology, Statistics Istructor: Teachig Assistat: Suzae Nezzar, Mathematics Chapter 13 Templates for More Abstractio

More information

Chapter 4 The Datapath

Chapter 4 The Datapath The Ageda Chapter 4 The Datapath Based o slides McGraw-Hill Additioal material 24/25/26 Lewis/Marti Additioal material 28 Roth Additioal material 2 Taylor Additioal material 2 Farmer Tae the elemets that

More information

Goals of the Lecture Object Constraint Language

Goals of the Lecture Object Constraint Language Goals of the Lecture Object Costrait Laguage Object-Orieted Aalysis ad Desig - Fall 1998 Preset the Object Costrait Laguage Ð As best as possible, with the limited iformatio available from UML i a Nutshell

More information

Computer Architecture ELEC3441

Computer Architecture ELEC3441 CPU-Memory Bottleeck Computer Architecture ELEC44 CPU Memory Lecture 8 Cache Dr. Hayde Kwok-Hay So Departmet of Electrical ad Electroic Egieerig Performace of high-speed computers is usually limited by

More information

Analysis of Algorithms

Analysis of Algorithms Presetatio for use with the textbook, Algorithm Desig ad Applicatios, by M. T. Goodrich ad R. Tamassia, Wiley, 2015 Aalysis of Algorithms Iput 2015 Goodrich ad Tamassia Algorithm Aalysis of Algorithms

More information

Code Review Defects. Authors: Mika V. Mäntylä and Casper Lassenius Original version: 4 Sep, 2007 Made available online: 24 April, 2013

Code Review Defects. Authors: Mika V. Mäntylä and Casper Lassenius Original version: 4 Sep, 2007 Made available online: 24 April, 2013 Code Review s Authors: Mika V. Mätylä ad Casper Lasseius Origial versio: 4 Sep, 2007 Made available olie: 24 April, 2013 This documet cotais further details of the code review defects preseted i [1]. of

More information

n Haskell n Covered syntax, lazy evaluation, static typing n Algebraic data types and pattern matching n Type classes n Monads and more n Types

n Haskell n Covered syntax, lazy evaluation, static typing n Algebraic data types and pattern matching n Type classes n Monads and more n Types Aoucemets Exam 2 is graded, but I will eed some time to go over it I ll release grades this eveig (figers crossed!) Raibow grades: HW1-6, Exam 1-2, Quiz 1-5 Will post aswer key Still gradig: Quiz 6, HW7

More information

A SOFTWARE MODEL FOR THE MULTILAYER PERCEPTRON

A SOFTWARE MODEL FOR THE MULTILAYER PERCEPTRON A SOFTWARE MODEL FOR THE MULTILAYER PERCEPTRON Roberto Lopez ad Eugeio Oñate Iteratioal Ceter for Numerical Methods i Egieerig (CIMNE) Edificio C1, Gra Capitá s/, 08034 Barceloa, Spai ABSTRACT I this work

More information

Major CSL Write your name and entry no on every sheet of the answer script. Time 2 Hrs Max Marks 70

Major CSL Write your name and entry no on every sheet of the answer script. Time 2 Hrs Max Marks 70 NOTE:. Attempt all seve questios. Major CSL 02 2. Write your ame ad etry o o every sheet of the aswer script. Time 2 Hrs Max Marks 70 Q No Q Q 2 Q 3 Q 4 Q 5 Q 6 Q 7 Total MM 6 2 4 0 8 4 6 70 Q. Write a

More information

Chapter 24. Sorting. Objectives. 1. To study and analyze time efficiency of various sorting algorithms

Chapter 24. Sorting. Objectives. 1. To study and analyze time efficiency of various sorting algorithms Chapter 4 Sortig 1 Objectives 1. o study ad aalyze time efficiecy of various sortig algorithms 4. 4.7.. o desig, implemet, ad aalyze bubble sort 4.. 3. o desig, implemet, ad aalyze merge sort 4.3. 4. o

More information

Morgan Kaufmann Publishers 26 February, COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface. Chapter 5

Morgan Kaufmann Publishers 26 February, COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface. Chapter 5 Morga Kaufma Publishers 26 February, 28 COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Iterface 5 th Editio Chapter 5 Set-Associative Cache Architecture Performace Summary Whe CPU performace icreases:

More information

Architectural styles for software systems The client-server style

Architectural styles for software systems The client-server style Architectural styles for software systems The cliet-server style Prof. Paolo Ciacarii Software Architecture CdL M Iformatica Uiversità di Bologa Ageda Cliet server style CS two tiers CS three tiers CS

More information

Programming with Shared Memory PART II. HPC Spring 2017 Prof. Robert van Engelen

Programming with Shared Memory PART II. HPC Spring 2017 Prof. Robert van Engelen Programmig with Shared Memory PART II HPC Sprig 2017 Prof. Robert va Egele Overview Sequetial cosistecy Parallel programmig costructs Depedece aalysis OpeMP Autoparallelizatio Further readig HPC Sprig

More information

Ones Assignment Method for Solving Traveling Salesman Problem

Ones Assignment Method for Solving Traveling Salesman Problem Joural of mathematics ad computer sciece 0 (0), 58-65 Oes Assigmet Method for Solvig Travelig Salesma Problem Hadi Basirzadeh Departmet of Mathematics, Shahid Chamra Uiversity, Ahvaz, Ira Article history:

More information

Overview. Chapter 18 Vectors and Arrays. Reminder. vector. Bjarne Stroustrup

Overview. Chapter 18 Vectors and Arrays. Reminder. vector. Bjarne Stroustrup Chapter 18 Vectors ad Arrays Bjare Stroustrup Vector revisited How are they implemeted? Poiters ad free store Destructors Iitializatio Copy ad move Arrays Array ad poiter problems Chagig size Templates

More information

Chapter 4 Threads. Operating Systems: Internals and Design Principles. Ninth Edition By William Stallings

Chapter 4 Threads. Operating Systems: Internals and Design Principles. Ninth Edition By William Stallings Operatig Systems: Iterals ad Desig Priciples Chapter 4 Threads Nith Editio By William Stalligs Processes ad Threads Resource Owership Process icludes a virtual address space to hold the process image The

More information

CIS 121 Data Structures and Algorithms with Java Spring Stacks and Queues Monday, February 12 / Tuesday, February 13

CIS 121 Data Structures and Algorithms with Java Spring Stacks and Queues Monday, February 12 / Tuesday, February 13 CIS Data Structures ad Algorithms with Java Sprig 08 Stacks ad Queues Moday, February / Tuesday, February Learig Goals Durig this lab, you will: Review stacks ad queues. Lear amortized ruig time aalysis

More information

Lazy Type Changes in Object-oriented Database. Shan Ming Woo and Barbara Liskov MIT Lab. for Computer Science December 1999

Lazy Type Changes in Object-oriented Database. Shan Ming Woo and Barbara Liskov MIT Lab. for Computer Science December 1999 Lazy Type Chages i Object-orieted Database Sha Mig Woo ad Barbara Liskov MIT Lab. for Computer Sciece December 1999 Backgroud wbehavior of OODB apps compose of behavior of persistet obj wbehavior of objects

More information

Module 8-7: Pascal s Triangle and the Binomial Theorem

Module 8-7: Pascal s Triangle and the Binomial Theorem Module 8-7: Pascal s Triagle ad the Biomial Theorem Gregory V. Bard April 5, 017 A Note about Notatio Just to recall, all of the followig mea the same thig: ( 7 7C 4 C4 7 7C4 5 4 ad they are (all proouced

More information

Abstract. Chapter 4 Computation. Overview 8/13/18. Bjarne Stroustrup Note:

Abstract. Chapter 4 Computation. Overview 8/13/18. Bjarne Stroustrup   Note: Chapter 4 Computatio Bjare Stroustrup www.stroustrup.com/programmig Abstract Today, I ll preset the basics of computatio. I particular, we ll discuss expressios, how to iterate over a series of values

More information

n Explore virtualization concepts n Become familiar with cloud concepts

n Explore virtualization concepts n Become familiar with cloud concepts Chapter Objectives Explore virtualizatio cocepts Become familiar with cloud cocepts Chapter #15: Architecture ad Desig 2 Hypervisor Virtualizatio ad cloud services are becomig commo eterprise tools to

More information

Recursive Procedures. How can you model the relationship between consecutive terms of a sequence?

Recursive Procedures. How can you model the relationship between consecutive terms of a sequence? 6. Recursive Procedures I Sectio 6.1, you used fuctio otatio to write a explicit formula to determie the value of ay term i a Sometimes it is easier to calculate oe term i a sequece usig the previous terms.

More information

The Magma Database file formats

The Magma Database file formats The Magma Database file formats Adrew Gaylard, Bret Pikey, ad Mart-Mari Breedt Johaesburg, South Africa 15th May 2006 1 Summary Magma is a ope-source object database created by Chris Muller, of Kasas City,

More information

Alpha Individual Solutions MAΘ National Convention 2013

Alpha Individual Solutions MAΘ National Convention 2013 Alpha Idividual Solutios MAΘ Natioal Covetio 0 Aswers:. D. A. C 4. D 5. C 6. B 7. A 8. C 9. D 0. B. B. A. D 4. C 5. A 6. C 7. B 8. A 9. A 0. C. E. B. D 4. C 5. A 6. D 7. B 8. C 9. D 0. B TB. 570 TB. 5

More information

Baan Tools User Management

Baan Tools User Management Baa Tools User Maagemet Module Procedure UP008A US Documetiformatio Documet Documet code : UP008A US Documet group : User Documetatio Documet title : User Maagemet Applicatio/Package : Baa Tools Editio

More information

The isoperimetric problem on the hypercube

The isoperimetric problem on the hypercube The isoperimetric problem o the hypercube Prepared by: Steve Butler November 2, 2005 1 The isoperimetric problem We will cosider the -dimesioal hypercube Q Recall that the hypercube Q is a graph whose

More information

CMPT 125 Assignment 2 Solutions

CMPT 125 Assignment 2 Solutions CMPT 25 Assigmet 2 Solutios Questio (20 marks total) a) Let s cosider a iteger array of size 0. (0 marks, each part is 2 marks) it a[0]; I. How would you assig a poiter, called pa, to store the address

More information

Computer Science Foundation Exam. August 12, Computer Science. Section 1A. No Calculators! KEY. Solutions and Grading Criteria.

Computer Science Foundation Exam. August 12, Computer Science. Section 1A. No Calculators! KEY. Solutions and Grading Criteria. Computer Sciece Foudatio Exam August, 005 Computer Sciece Sectio A No Calculators! Name: SSN: KEY Solutios ad Gradig Criteria Score: 50 I this sectio of the exam, there are four (4) problems. You must

More information

Computational Geometry

Computational Geometry Computatioal Geometry Chapter 4 Liear programmig Duality Smallest eclosig disk O the Ageda Liear Programmig Slides courtesy of Craig Gotsma 4. 4. Liear Programmig - Example Defie: (amout amout cosumed

More information

Chapter 6. I/O Streams as an Introduction to Objects and Classes. Copyright 2014 Pearson Addison-Wesley. All rights reserved.

Chapter 6. I/O Streams as an Introduction to Objects and Classes. Copyright 2014 Pearson Addison-Wesley. All rights reserved. Chapter 6 I/O Streams as a Itroductio to Objects ad Classes Overview 6.1 Streams ad Basic File I/O 6.2 Tools for Stream I/O 6.3 Character I/O Slide 6-3 6.1 Streams ad Basic File I/O I/O Streams I/O refers

More information

Hash Tables. Presentation for use with the textbook Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 2015.

Hash Tables. Presentation for use with the textbook Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 2015. Presetatio for use with the textbook Algorithm Desig ad Applicatios, by M. T. Goodrich ad R. Tamassia, Wiley, 2015 Hash Tables xkcd. http://xkcd.com/221/. Radom Number. Used with permissio uder Creative

More information

ifs considered Harmful

ifs considered Harmful ifs cosidered Harmful Or; how to elimiate 90% of your bugs ad 99% of your techical debt i oe easy step. Jules May JulesMay.co.uk Codebase survey Bugs: all ~2.5 millio lies 5 years developmet 6-25 developers

More information

WYSE Academic Challenge Sectional Computer Science 2005 SOLUTION SET

WYSE Academic Challenge Sectional Computer Science 2005 SOLUTION SET WYSE Academic Challege Sectioal Computer Sciece 2005 SOLUTION SET 1. Correct aswer: a. Hz = cycle / secod. CPI = 2, therefore, CPI*I = 2 * 28 X 10 8 istructios = 56 X 10 8 cycles. The clock rate is 56

More information

Compiling and executing managed code

Compiling and executing managed code Compilig ad exectig maaged code Sorce Code Compilatio Lagage Compiler Microsoft Itermediate Lagage (MSIL) The first time each method is called Native Code Exectio JIT Compiler Commo Lagage Rtime C# .NET

More information

EVALUATION OF TRIGONOMETRIC FUNCTIONS

EVALUATION OF TRIGONOMETRIC FUNCTIONS EVALUATION OF TRIGONOMETRIC FUNCTIONS Whe first exposed to trigoometric fuctios i high school studets are expected to memorize the values of the trigoometric fuctios of sie cosie taget for the special

More information