A Taste of Java and Object-Oriented Programming

Size: px
Start display at page:

Download "A Taste of Java and Object-Oriented Programming"

Transcription

1 Introducn Computer Scence Shm Schocken IDC Herzlya Lecture 1-2: Lecture 1-2: A Taste Java Object-Orented Programmng A Taste Java OO programmng, Shm Schocken, IDC Herzlya, slde 1 Lecture outlne Java background Java program example Basc syntax rules Program development lfe cycle A taste object orented programmng Homework exercse 1 A Taste Java OO programmng, Shm Schocken, IDC Herzlya, slde 2 Inrducn Computer Scence Shm Schocken IDC Herzlya 21

2 Java background Bref hsry: 1995: nvented by James Goslng at Sun Mcrosystems (1995) Orgnal desgn objectve: a programmng language for Internet: safety portablty Actual accomplshment: a great language n almost every respect Borrows from many or languages: C / C, Pascal, Scheme, SmallTalk 1996: IDC adopts Java as CS11 programmng language 1999: Mcrost releases C# Why dd we adopt Java? Because Java... Is object orented (OO) Encourages good programmng habts Smlar C, but smpler more elegant Commercal Cool. A Taste Java OO programmng, Shm Schocken, IDC Herzlya, slde 3 Java program example Task: Prnt numbers 5 Algorthm: Java mplementan: ; ; whle whle ( ( prnt prnt 1 1 prnts prnts numbers numbers 5 5 publc publc PrntSomeNumbers PrntSomeNumbers publc publc statc statc vod vod man(strng[] man(strng[] args) args) declare declare an an nteger nteger varable varable set set t t nt nt ; ; whle whle ( ( prnt prnt current current value value System.out.prntln(); System.out.prntln(); 1; 1; System.out.prntln( De ); System.out.prntln( De ); A Taste Java OO programmng, Shm Schocken, IDC Herzlya, slde 4 Inrducn Computer Scence Shm Schocken IDC Herzlya 21

3 Java syntax elements (frst approxman) keyword dentfer prnts prnts numbers numbers 5 5 comment publc publc PrntSomeNumbers PrntSomeNumbers publc publc statc statc vod vod man(strng[] man(strng[] args) args) declare declare an an nteger nteger varable varable set set t t nt nt ; ; symbol whle whle ( ( prnt prnt current current value value System.out.prntln(); System.out.prntln(); 1; 1; System.out.prntln( De ); System.out.prntln( De ); Strng numerc lteral lteral Words : Reserved words Identfers Lterals: Numbers Strngs (More later) Symbols: ( ) [ ],. ; - * / Comments Text begnnng wth A Taste Java OO programmng, Shm Schocken, IDC Herzlya, slde 5 Java reserved words abstract ctnue for new swtch assert default go(*) package synchrzed boolean do f prvate ths break double mplements protected throw byte else mport publc throws case enum nstance return transent catch extends nt short try char fnal nterface statc vod fnally lg strct volatle cst(*) float natve super whle (*): Not used. A Taste Java OO programmng, Shm Schocken, IDC Herzlya, slde 6 Inrducn Computer Scence Shm Schocken IDC Herzlya 21

4 Java program structure Program (loosely defned): cssts e or more es Class: cssts e or more methods, e whch must be named Man() Method: a sequence statements Statement: ends wth a semcol (;) or enclosed n curly braces ( ) program publc publc PrntSomeNumbers PrntSomeNumbers publc publc statc publc vod man(strng[] xxx xxx args) publc statc vod man(strng[] args) nt ; publc yyy nt ; publc yyy publc PrntSomeNumbers whle ( publc PrntSomeNumbers whle ( publc statc vo publc statc vo prnt current value prnt current value System.out.prntln(); method System.out.prntln(); statements 1; 1; System.out.prntln( De ); System.out.prntln( De ); More methods follow... More methods follow... A Taste Java OO programmng, Shm Schocken, IDC Herzlya, slde 7 Whte space prnts prnts numbers numbers 5 5 publc publc PrntSomeNumbers PrntSomeNumbers publc publc statc statc vod vod man(strng[] man(strng[] args) args) declare declare an an nteger nteger varable varable set set t t nt nt ; ; whle whle ( ( prnt prnt current current value value System.out.prntln(); System.out.prntln(); 1; 1; System.out.prntln( De ); System.out.prntln( De ); Same funcnalty publc publc PrntSomeNumbers PrntSomeNumbers publc publc statc statc vod vod man(strng[] man(strng[] args)nt args)nt ;whle ;whle (5)System.out.prntln();1;System.out.prntln( De ); (5)System.out.prntln();1;System.out.prntln( De ); Whte space comments ndentan (gnored by compler). Whte space, left programmer s dscren, s used for readablty Purpose: To make programs readable Important: Program readablty clarty are as mportant as program correctness (maybe more)! A Taste Java OO programmng, Shm Schocken, IDC Herzlya, slde 8 Inrducn Computer Scence Shm Schocken IDC Herzlya 21

5 Syntax / semantcs / style Syntax: rules language: vocabulary grammar Semantcs: what a sentence n language means Style: how well do you say t? Natural languages: Sometmes t s allowed break syntax rules Occasally re s more than e meanng a sentence. Programmng languages: You are never allowed break syntax rules There s ly e semantc nterpretan: no ambguty. A Taste Java OO programmng, Shm Schocken, IDC Herzlya, slde 9 Lecture outlne Java background Java program example Basc syntax rules Program development lfe cycle A taste object orented programmng Homework exercse 1 A Taste Java OO programmng, Shm Schocken, IDC Herzlya, slde 1 Inrducn Computer Scence Shm Schocken IDC Herzlya 21

6 Java program development lfe cycle Edt Xxx.java Java source fle javac Java compler Debuggng process Xxx. Bytecode fle java Java nterpreter Happy wth results? No Yes A Taste Java OO programmng, Shm Schocken, IDC Herzlya, slde 11 The ols trade: bascs Plan text edr Complan execun: Debuggng. Run program 1. Observe program s execun 2. Fgure out what s wrg 3. Fx code n edr 4. Go step A Taste Java OO programmng, Shm Schocken, IDC Herzlya, slde 12 Inrducn Computer Scence Shm Schocken IDC Herzlya 21

7 The ols trade: Integrated Development Envrments IDE: a stware package that features a combnan : Edr (programmng-orented) Compler Debugger Project Manager Many more cool goodes Some Commercal IDEs: Eclpse (open source) Vsual Age IntelJ Jcrear NetBeans... A Taste Java OO programmng, Shm Schocken, IDC Herzlya, slde 13 Debuggng That s what you ll do most semester Error types: Comple-tme errors: mostly syntax volans; detected by compler Run-tme errors: program passes complan, runs, but crashes Logcal errors: The program runs, dg somethng you ddn t want t do The program runs, but should be mproved for some reas. Murphy s Law: Anythng that can possbly go wrg, wll. Errors are portals dscovery (James Joyce) A Taste Java OO programmng, Shm Schocken, IDC Herzlya, slde 14 Inrducn Computer Scence Shm Schocken IDC Herzlya 21

8 Lecture outlne Java background Java program example Basc syntax rules Program development lfe cycle A taste object orented programmng Homework exercse 1 A Taste Java OO programmng, Shm Schocken, IDC Herzlya, slde 15 Introducng turtle Turtle descrpn (nformal) A turtle turtle s s a a turtle-lke turtle-lke graphcal graphcal mage mage that that moves moves screen screen under under program s program s ctrol. ctrol. When When turtle s turtle s tal tal s s down, down, movements movements are are traced traced (drawn (drawn screen). screen). When When tal tal s s up, up, movements movements are are not not traced. traced. Turtle abstracn (formal) A formal, formal, structured structured descrpn descrpn Turtle s Turtle s propertes propertes operans. operans. Amed Amed at at programmers programmers who who wsh wsh cstruct cstruct manpulate manpulate turtles turtles (Turtle (Turtle objects). objects). The The turtle turtle s s always always facng facng a a certan certan drecn, drecn, ts ts tal tal s s always always er er up up or or down. down. We We wsh wsh be be able able cstruct cstruct turtles turtles (Turtle (Turtle objects) objects) move move m m screen screen under under program program ctrol ctrol Turtle mplementan A publc publc Java Java,, named named Turtle, Turtle, that that mplements mplements Turtle Turtle abstracn. abstracn. A Taste Java OO programmng, Shm Schocken, IDC Herzlya, slde 16 Inrducn Computer Scence Shm Schocken IDC Herzlya 21

9 Turtle abstracn Turtle nterface Turtle API Turtle API (partal) The Turtle mplementan s a black box: we have no access ts code The Turtle abstracn (API) s a publcly avalable document The API specfes whch operans can be nvoked Turtle objects, how nvoke m Some se operans are desgned create new Turtle objects, whle ors are desgned manpulate exstng Turtle objects OOP Termnology: The words Abstracn Class nterface API Mean same thng: a structured, agreedup, user-orented way document funcnalty. A Taste Java OO programmng, Shm Schocken, IDC Herzlya, slde 17 Usng Turtle API Turtle API (partal) Turtle usage example publc publc TurtleDrawngDemo TurtleDrawngDemo publc publc statc statc vod vod man(strng[] man(strng[] args) args) Turtle Turtle leardo leardo new new Turtle(); Turtle(); leardo.taldown(); leardo.taldown(); leardo.moveforward(1); leardo.moveforward(1); leardo.turnrght(; leardo.turnrght(; leardo.moveforward(1); leardo.moveforward(1); A Taste Java OO programmng, Shm Schocken, IDC Herzlya, slde 18 Inrducn Computer Scence Shm Schocken IDC Herzlya 21

10 Object orented programmng In OOP, much programmng actvty evolves around creatng manpulatng objects certan types. For example, leardo s an object type Turtle The rules for creatng manpulatng objects are specfed n nterfaces Some se es are mplemented by you; some es come from Java lbrary; some are mplemented by or programmers who you may or may not know For example, f somee wrote a named BouncngBall made t publcly avalable, programmers who develop applcans that need bouncng ball funcnalty can now use BouncngBall API Some OOP advantages Code reuse: no need re-nvent wheel Code csstency Dvde cquer Modularty. A Taste Java OO programmng, Shm Schocken, IDC Herzlya, slde 19 Homework Exercse 1 Play wth a smple Java program Experence debuggng Do some turtle graphcs Furr nstrucns: see course web ste. A Taste Java OO programmng, Shm Schocken, IDC Herzlya, slde 2 Inrducn Computer Scence Shm Schocken IDC Herzlya 21

News. Recap: While Loop Example. Reading. Recap: Do Loop Example. Recap: For Loop Example

News. Recap: While Loop Example. Reading. Recap: Do Loop Example. Recap: For Loop Example Unversty of Brtsh Columba CPSC, Intro to Computaton Jan-Apr Tamara Munzner News Assgnment correctons to ASCIIArtste.java posted defntely read WebCT bboards Arrays Lecture, Tue Feb based on sldes by Kurt

More information

Pass by Reference vs. Pass by Value

Pass by Reference vs. Pass by Value Pass by Reference vs. Pass by Value Most methods are passed arguments when they are called. An argument may be a constant or a varable. For example, n the expresson Math.sqrt(33) the constant 33 s passed

More information

Outline. CIS 110: Introduction to Computer Programming. Review: Interactive Sum. More Cumulative Algorithms. Interactive Sum Trace (2)

Outline. CIS 110: Introduction to Computer Programming. Review: Interactive Sum. More Cumulative Algorithms. Interactive Sum Trace (2) Outlne CIS 110: Introducton to Computer Programmng More on Cumulatve Algorthms Processng Text Tacklng Programmng Problems Lecture 11 Text Processng and More On Desgn ( 4.2-4.3) 10/17/2011 CIS 110 (11fa)

More information

Terminal Window. 11. Section 7 Exercises Program Memory Exercise 7-1 Swap Values in an Array Working memory Global Memory. 2 nd call 3 rd call

Terminal Window. 11. Section 7 Exercises Program Memory Exercise 7-1 Swap Values in an Array Working memory Global Memory. 2 nd call 3 rd call 11. Secton 7 Exercses Program Memory Exercse 7-1 Swap Values n an Array Workng memory Global Memory class SwapTlYouDrop publc statc vod man (Strng args[ ]) nt = 0; nt a; a = new nt[] 2, 4, 6, 8, 10, 12

More information

Notes on Organizing Java Code: Packages, Visibility, and Scope

Notes on Organizing Java Code: Packages, Visibility, and Scope Notes on Organzng Java Code: Packages, Vsblty, and Scope CS 112 Wayne Snyder Java programmng n large measure s a process of defnng enttes (.e., packages, classes, methods, or felds) by name and then usng

More information

Assembler. Building a Modern Computer From First Principles.

Assembler. Building a Modern Computer From First Principles. Assembler Buldng a Modern Computer From Frst Prncples www.nand2tetrs.org Elements of Computng Systems, Nsan & Schocken, MIT Press, www.nand2tetrs.org, Chapter 6: Assembler slde Where we are at: Human Thought

More information

Assembler. Shimon Schocken. Spring Elements of Computing Systems 1 Assembler (Ch. 6) Compiler. abstract interface.

Assembler. Shimon Schocken. Spring Elements of Computing Systems 1 Assembler (Ch. 6) Compiler. abstract interface. IDC Herzlya Shmon Schocken Assembler Shmon Schocken Sprng 2005 Elements of Computng Systems 1 Assembler (Ch. 6) Where we are at: Human Thought Abstract desgn Chapters 9, 12 abstract nterface H.L. Language

More information

Outline. CIS 110: Intro to Computer Programming. What Do Our Programs Look Like? The Scanner Object. CIS 110 (11fa) - University of Pennsylvania 1

Outline. CIS 110: Intro to Computer Programming. What Do Our Programs Look Like? The Scanner Object. CIS 110 (11fa) - University of Pennsylvania 1 Outlne CIS 110: Intro to Computer Programmng The Scanner Object Introducng Condtonal Statements Cumulatve Algorthms Lecture 10 Interacton and Condtonals ( 3.3, 4.1-4.2) 10/15/2011 CIS 110 (11fa) - Unversty

More information

CMPS 10 Introduction to Computer Science Lecture Notes

CMPS 10 Introduction to Computer Science Lecture Notes CPS 0 Introducton to Computer Scence Lecture Notes Chapter : Algorthm Desgn How should we present algorthms? Natural languages lke Englsh, Spansh, or French whch are rch n nterpretaton and meanng are not

More information

Harvard University CS 101 Fall 2005, Shimon Schocken. Assembler. Elements of Computing Systems 1 Assembler (Ch. 6)

Harvard University CS 101 Fall 2005, Shimon Schocken. Assembler. Elements of Computing Systems 1 Assembler (Ch. 6) Harvard Unversty CS 101 Fall 2005, Shmon Schocken Assembler Elements of Computng Systems 1 Assembler (Ch. 6) Why care about assemblers? Because Assemblers employ some nfty trcks Assemblers are the frst

More information

Virtual Memory. Background. No. 10. Virtual Memory: concept. Logical Memory Space (review) Demand Paging(1) Virtual Memory

Virtual Memory. Background. No. 10. Virtual Memory: concept. Logical Memory Space (review) Demand Paging(1) Virtual Memory Background EECS. Operatng System Fundamentals No. Vrtual Memory Prof. Hu Jang Department of Electrcal Engneerng and Computer Scence, York Unversty Memory-management methods normally requres the entre process

More information

Esc101 Lecture 1 st April, 2008 Generating Permutation

Esc101 Lecture 1 st April, 2008 Generating Permutation Esc101 Lecture 1 Aprl, 2008 Generatng Permutaton In ths class we wll look at a problem to wrte a program that takes as nput 1,2,...,N and prnts out all possble permutatons of the numbers 1,2,...,N. For

More information

ON SOME ENTERTAINING APPLICATIONS OF THE CONCEPT OF SET IN COMPUTER SCIENCE COURSE

ON SOME ENTERTAINING APPLICATIONS OF THE CONCEPT OF SET IN COMPUTER SCIENCE COURSE Yordzhev K., Kostadnova H. Інформаційні технології в освіті ON SOME ENTERTAINING APPLICATIONS OF THE CONCEPT OF SET IN COMPUTER SCIENCE COURSE Yordzhev K., Kostadnova H. Some aspects of programmng educaton

More information

Sequential search. Building Java Programs Chapter 13. Sequential search. Sequential search

Sequential search. Building Java Programs Chapter 13. Sequential search. Sequential search Sequental search Buldng Java Programs Chapter 13 Searchng and Sortng sequental search: Locates a target value n an array/lst by examnng each element from start to fnsh. How many elements wll t need to

More information

On Some Entertaining Applications of the Concept of Set in Computer Science Course

On Some Entertaining Applications of the Concept of Set in Computer Science Course On Some Entertanng Applcatons of the Concept of Set n Computer Scence Course Krasmr Yordzhev *, Hrstna Kostadnova ** * Assocate Professor Krasmr Yordzhev, Ph.D., Faculty of Mathematcs and Natural Scences,

More information

CS221: Algorithms and Data Structures. Priority Queues and Heaps. Alan J. Hu (Borrowing slides from Steve Wolfman)

CS221: Algorithms and Data Structures. Priority Queues and Heaps. Alan J. Hu (Borrowing slides from Steve Wolfman) CS: Algorthms and Data Structures Prorty Queues and Heaps Alan J. Hu (Borrowng sldes from Steve Wolfman) Learnng Goals After ths unt, you should be able to: Provde examples of approprate applcatons for

More information

Midterms Save the Dates!

Midterms Save the Dates! Unversty of Brtsh Columba CPSC, Intro to Computaton Alan J. Hu Readngs Ths Week: Ch 6 (Ch 7 n old 2 nd ed). (Remnder: Readngs are absolutely vtal for learnng ths stuff!) Thnkng About Loops Lecture 9 Some

More information

Computer models of motion: Iterative calculations

Computer models of motion: Iterative calculations Computer models o moton: Iteratve calculatons OBJECTIVES In ths actvty you wll learn how to: Create 3D box objects Update the poston o an object teratvely (repeatedly) to anmate ts moton Update the momentum

More information

Brave New World Pseudocode Reference

Brave New World Pseudocode Reference Brave New World Pseudocode Reference Pseudocode s a way to descrbe how to accomplsh tasks usng basc steps lke those a computer mght perform. In ths week s lab, you'll see how a form of pseudocode can be

More information

OPL: a modelling language

OPL: a modelling language OPL: a modellng language Carlo Mannno (from OPL reference manual) Unversty of Oslo, INF-MAT60 - Autumn 00 (Mathematcal optmzaton) ILOG Optmzaton Programmng Language OPL s an Optmzaton Programmng Language

More information

CHARUTAR VIDYA MANDAL S SEMCOM Vallabh Vidyanagar

CHARUTAR VIDYA MANDAL S SEMCOM Vallabh Vidyanagar CHARUTAR VIDYA MANDAL S SEMCOM Vallabh Vdyanagar Faculty Name: Am D. Trved Class: SYBCA Subject: US03CBCA03 (Advanced Data & Fle Structure) *UNIT 1 (ARRAYS AND TREES) **INTRODUCTION TO ARRAYS If we want

More information

Complex Numbers. Now we also saw that if a and b were both positive then ab = a b. For a second let s forget that restriction and do the following.

Complex Numbers. Now we also saw that if a and b were both positive then ab = a b. For a second let s forget that restriction and do the following. Complex Numbers The last topc n ths secton s not really related to most of what we ve done n ths chapter, although t s somewhat related to the radcals secton as we wll see. We also won t need the materal

More information

Loop Transformations, Dependences, and Parallelization

Loop Transformations, Dependences, and Parallelization Loop Transformatons, Dependences, and Parallelzaton Announcements Mdterm s Frday from 3-4:15 n ths room Today Semester long project Data dependence recap Parallelsm and storage tradeoff Scalar expanson

More information

Overview. CSC 2400: Computer Systems. Pointers in C. Pointers - Variables that hold memory addresses - Using pointers to do call-by-reference in C

Overview. CSC 2400: Computer Systems. Pointers in C. Pointers - Variables that hold memory addresses - Using pointers to do call-by-reference in C CSC 2400: Comuter Systems Ponters n C Overvew Ponters - Varables that hold memory addresses - Usng onters to do call-by-reference n C Ponters vs. Arrays - Array names are constant onters Ponters and Strngs

More information

LLVM passes and Intro to Loop Transformation Frameworks

LLVM passes and Intro to Loop Transformation Frameworks LLVM passes and Intro to Loop Transformaton Frameworks Announcements Ths class s recorded and wll be n D2L panapto. No quz Monday after sprng break. Wll be dong md-semester class feedback. Today LLVM passes

More information

Agenda & Reading. Simple If. Decision-Making Statements. COMPSCI 280 S1C Applications Programming. Programming Fundamentals

Agenda & Reading. Simple If. Decision-Making Statements. COMPSCI 280 S1C Applications Programming. Programming Fundamentals Agenda & Readng COMPSCI 8 SC Applcatons Programmng Programmng Fundamentals Control Flow Agenda: Decsonmakng statements: Smple If, Ifelse, nested felse, Select Case s Whle, DoWhle/Untl, For, For Each, Nested

More information

CS1100 Introduction to Programming

CS1100 Introduction to Programming Factoral (n) Recursve Program fact(n) = n*fact(n-) CS00 Introducton to Programmng Recurson and Sortng Madhu Mutyam Department of Computer Scence and Engneerng Indan Insttute of Technology Madras nt fact

More information

Today s Outline. Sorting: The Big Picture. Why Sort? Selection Sort: Idea. Insertion Sort: Idea. Sorting Chapter 7 in Weiss.

Today s Outline. Sorting: The Big Picture. Why Sort? Selection Sort: Idea. Insertion Sort: Idea. Sorting Chapter 7 in Weiss. Today s Outlne Sortng Chapter 7 n Wess CSE 26 Data Structures Ruth Anderson Announcements Wrtten Homework #6 due Frday 2/26 at the begnnng of lecture Proect Code due Mon March 1 by 11pm Today s Topcs:

More information

Oracle Database: SQL and PL/SQL Fundamentals Certification Course

Oracle Database: SQL and PL/SQL Fundamentals Certification Course Oracle Database: SQL and PL/SQL Fundamentals Certfcaton Course 1 Duraton: 5 Days (30 hours) What you wll learn: Ths Oracle Database: SQL and PL/SQL Fundamentals tranng delvers the fundamentals of SQL and

More information

Computer Hardware 6. The

Computer Hardware 6. The The The Consultation, (1990-Present) Design Table of Contents [CHAPTER] 1 j NTRODUCTON 1 [CHAPTER] 2 1.1 Two Fundamental deas of Computer Science: Algorithms and nformation Processing 2 1,1.1 Algorithms

More information

For instance, ; the five basic number-sets are increasingly more n A B & B A A = B (1)

For instance, ; the five basic number-sets are increasingly more n A B & B A A = B (1) Secton 1.2 Subsets and the Boolean operatons on sets If every element of the set A s an element of the set B, we say that A s a subset of B, or that A s contaned n B, or that B contans A, and we wrte A

More information

Module Management Tool in Software Development Organizations

Module Management Tool in Software Development Organizations Journal of Computer Scence (5): 8-, 7 ISSN 59-66 7 Scence Publcatons Management Tool n Software Development Organzatons Ahmad A. Al-Rababah and Mohammad A. Al-Rababah Faculty of IT, Al-Ahlyyah Amman Unversty,

More information

NUMERICAL SOLVING OPTIMAL CONTROL PROBLEMS BY THE METHOD OF VARIATIONS

NUMERICAL SOLVING OPTIMAL CONTROL PROBLEMS BY THE METHOD OF VARIATIONS ARPN Journal of Engneerng and Appled Scences 006-017 Asan Research Publshng Network (ARPN). All rghts reserved. NUMERICAL SOLVING OPTIMAL CONTROL PROBLEMS BY THE METHOD OF VARIATIONS Igor Grgoryev, Svetlana

More information

Lecture 5: Multilayer Perceptrons

Lecture 5: Multilayer Perceptrons Lecture 5: Multlayer Perceptrons Roger Grosse 1 Introducton So far, we ve only talked about lnear models: lnear regresson and lnear bnary classfers. We noted that there are functons that can t be represented

More information

K-means and Hierarchical Clustering

K-means and Hierarchical Clustering Note to other teachers and users of these sldes. Andrew would be delghted f you found ths source materal useful n gvng your own lectures. Feel free to use these sldes verbatm, or to modfy them to ft your

More information

COMP 202 Java in one week

COMP 202 Java in one week COMP 202 Java in one week... Continued CONTENTS: Return to material from previous lecture At-home programming exercises Please Do Ask Questions It's perfectly normal not to understand everything Most of

More information

PHYSICS-ENHANCED L-SYSTEMS

PHYSICS-ENHANCED L-SYSTEMS PHYSICS-ENHANCED L-SYSTEMS Hansrud Noser 1, Stephan Rudolph 2, Peter Stuck 1 1 Department of Informatcs Unversty of Zurch, Wnterthurerstr. 190 CH-8057 Zurch Swtzerland noser(stuck)@f.unzh.ch, http://www.f.unzh.ch/~noser(~stuck)

More information

Some material adapted from Mohamed Younis, UMBC CMSC 611 Spr 2003 course slides Some material adapted from Hennessy & Patterson / 2003 Elsevier

Some material adapted from Mohamed Younis, UMBC CMSC 611 Spr 2003 course slides Some material adapted from Hennessy & Patterson / 2003 Elsevier Some materal adapted from Mohamed Youns, UMBC CMSC 611 Spr 2003 course sldes Some materal adapted from Hennessy & Patterson / 2003 Elsever Scence Performance = 1 Executon tme Speedup = Performance (B)

More information

Intro. Iterators. 1. Access

Intro. Iterators. 1. Access Intro Ths mornng I d lke to talk a lttle bt about s and s. We wll start out wth smlartes and dfferences, then we wll see how to draw them n envronment dagrams, and we wll fnsh wth some examples. Happy

More information

Midterms Save the Dates!

Midterms Save the Dates! Unversty of Brtsh Columba CPSC, Intro to Computaton Alan J. Hu Thnkng About Loops Intro to Arrays (Obect References?) Readngs Ths Week: Ch 6 (Ch 7 n old 2 nd ed). Next Week: Ch 7 (Ch 8 n old 2 nd ed).

More information

Introduction to Programming. Lecture 13: Container data structures. Container data structures. Topics for this lecture. A basic issue with containers

Introduction to Programming. Lecture 13: Container data structures. Container data structures. Topics for this lecture. A basic issue with containers 1 2 Introducton to Programmng Bertrand Meyer Lecture 13: Contaner data structures Last revsed 1 December 2003 Topcs for ths lecture 3 Contaner data structures 4 Contaners and genercty Contan other objects

More information

Machine Learning: Algorithms and Applications

Machine Learning: Algorithms and Applications 14/05/1 Machne Learnng: Algorthms and Applcatons Florano Zn Free Unversty of Bozen-Bolzano Faculty of Computer Scence Academc Year 011-01 Lecture 10: 14 May 01 Unsupervsed Learnng cont Sldes courtesy of

More information

Exercises (Part 4) Introduction to R UCLA/CCPR. John Fox, February 2005

Exercises (Part 4) Introduction to R UCLA/CCPR. John Fox, February 2005 Exercses (Part 4) Introducton to R UCLA/CCPR John Fox, February 2005 1. A challengng problem: Iterated weghted least squares (IWLS) s a standard method of fttng generalzed lnear models to data. As descrbed

More information

Nachos Project 3. Speaker: Sheng-Wei Cheng 2010/12/16

Nachos Project 3. Speaker: Sheng-Wei Cheng 2010/12/16 Nachos Project Speaker: Sheng-We Cheng //6 Agenda Motvaton User Programs n Nachos Related Nachos Code for User Programs Project Assgnment Bonus Submsson Agenda Motvaton User Programs n Nachos Related Nachos

More information

Course Introduction. Algorithm 8/31/2017. COSC 320 Advanced Data Structures and Algorithms. COSC 320 Advanced Data Structures and Algorithms

Course Introduction. Algorithm 8/31/2017. COSC 320 Advanced Data Structures and Algorithms. COSC 320 Advanced Data Structures and Algorithms Course Introducton Course Topcs Exams, abs, Proects A quc loo at a few algorthms 1 Advanced Data Structures and Algorthms Descrpton: We are gong to dscuss algorthm complexty analyss, algorthm desgn technques

More information

presentations Design simple Visual brevity will help a great talk. Shopping Preference Before&After Continued Continued Inside 15% Outside 85%

presentations Design simple Visual brevity will help a great talk. Shopping Preference Before&After Continued Continued Inside 15% Outside 85% Shoppng Preference Insde 15% Outsde 85% Desgn smple www.vnewoodparkproject.com presentatons Vsual brevty wll help a great talk. Contnued Contnued Desgn smple presentatons You, not your PowerPont sldes,

More information

Sorting Review. Sorting. Comparison Sorting. CSE 680 Prof. Roger Crawfis. Assumptions

Sorting Review. Sorting. Comparison Sorting. CSE 680 Prof. Roger Crawfis. Assumptions Sortng Revew Introducton to Algorthms Qucksort CSE 680 Prof. Roger Crawfs Inserton Sort T(n) = Θ(n 2 ) In-place Merge Sort T(n) = Θ(n lg(n)) Not n-place Selecton Sort (from homework) T(n) = Θ(n 2 ) In-place

More information

Programming in Fortran 90 : 2017/2018

Programming in Fortran 90 : 2017/2018 Programmng n Fortran 90 : 2017/2018 Programmng n Fortran 90 : 2017/2018 Exercse 1 : Evaluaton of functon dependng on nput Wrte a program who evaluate the functon f (x,y) for any two user specfed values

More information

A Binarization Algorithm specialized on Document Images and Photos

A Binarization Algorithm specialized on Document Images and Photos A Bnarzaton Algorthm specalzed on Document mages and Photos Ergna Kavalleratou Dept. of nformaton and Communcaton Systems Engneerng Unversty of the Aegean kavalleratou@aegean.gr Abstract n ths paper, a

More information

Assignment # 2. Farrukh Jabeen Algorithms 510 Assignment #2 Due Date: June 15, 2009.

Assignment # 2. Farrukh Jabeen Algorithms 510 Assignment #2 Due Date: June 15, 2009. Farrukh Jabeen Algorthms 51 Assgnment #2 Due Date: June 15, 29. Assgnment # 2 Chapter 3 Dscrete Fourer Transforms Implement the FFT for the DFT. Descrbed n sectons 3.1 and 3.2. Delverables: 1. Concse descrpton

More information

Outline. Discriminative classifiers for image recognition. Where in the World? A nearest neighbor recognition example 4/14/2011. CS 376 Lecture 22 1

Outline. Discriminative classifiers for image recognition. Where in the World? A nearest neighbor recognition example 4/14/2011. CS 376 Lecture 22 1 4/14/011 Outlne Dscrmnatve classfers for mage recognton Wednesday, Aprl 13 Krsten Grauman UT-Austn Last tme: wndow-based generc obect detecton basc ppelne face detecton wth boostng as case study Today:

More information

CSE 326: Data Structures Quicksort Comparison Sorting Bound

CSE 326: Data Structures Quicksort Comparison Sorting Bound CSE 326: Data Structures Qucksort Comparson Sortng Bound Bran Curless Sprng 2008 Announcements (5/14/08) Homework due at begnnng of class on Frday. Secton tomorrow: Graded homeworks returned More dscusson

More information

An Optimal Algorithm for Prufer Codes *

An Optimal Algorithm for Prufer Codes * J. Software Engneerng & Applcatons, 2009, 2: 111-115 do:10.4236/jsea.2009.22016 Publshed Onlne July 2009 (www.scrp.org/journal/jsea) An Optmal Algorthm for Prufer Codes * Xaodong Wang 1, 2, Le Wang 3,

More information

Objectives. Problem Solving. Introduction. An overview of object-oriented concepts. Programming and programming languages An introduction to Java

Objectives. Problem Solving. Introduction. An overview of object-oriented concepts. Programming and programming languages An introduction to Java Introduction Objectives An overview of object-oriented concepts. Programming and programming languages An introduction to Java 1-2 Problem Solving The purpose of writing a program is to solve a problem

More information

High level vs Low Level. What is a Computer Program? What does gcc do for you? Program = Instructions + Data. Basic Computer Organization

High level vs Low Level. What is a Computer Program? What does gcc do for you? Program = Instructions + Data. Basic Computer Organization What s a Computer Program? Descrpton of algorthms and data structures to acheve a specfc ojectve Could e done n any language, even a natural language lke Englsh Programmng language: A Standard notaton

More information

Parallelism for Nested Loops with Non-uniform and Flow Dependences

Parallelism for Nested Loops with Non-uniform and Flow Dependences Parallelsm for Nested Loops wth Non-unform and Flow Dependences Sam-Jn Jeong Dept. of Informaton & Communcaton Engneerng, Cheonan Unversty, 5, Anseo-dong, Cheonan, Chungnam, 330-80, Korea. seong@cheonan.ac.kr

More information

Java Bytecode (binary file)

Java Bytecode (binary file) Java is Compiled Unlike Python, which is an interpreted langauge, Java code is compiled. In Java, a compiler reads in a Java source file (the code that we write), and it translates that code into bytecode.

More information

Lecture 2. COMP1406/1006 (the Java course) Fall M. Jason Hinek Carleton University

Lecture 2. COMP1406/1006 (the Java course) Fall M. Jason Hinek Carleton University Lecture 2 COMP1406/1006 (the Java course) Fall 2013 M. Jason Hinek Carleton University today s agenda a quick look back (last Thursday) assignment 0 is posted and is due this Friday at 2pm Java compiling

More information

Concurrent models of computation for embedded software

Concurrent models of computation for embedded software Concurrent models of computaton for embedded software and hardware! Researcher overvew what t looks lke semantcs what t means and how t relates desgnng an actor language actor propertes and how to represent

More information

3D vector computer graphics

3D vector computer graphics 3D vector computer graphcs Paolo Varagnolo: freelance engneer Padova Aprl 2016 Prvate Practce ----------------------------------- 1. Introducton Vector 3D model representaton n computer graphcs requres

More information

Kent State University CS 4/ Design and Analysis of Algorithms. Dept. of Math & Computer Science LECT-16. Dynamic Programming

Kent State University CS 4/ Design and Analysis of Algorithms. Dept. of Math & Computer Science LECT-16. Dynamic Programming CS 4/560 Desgn and Analyss of Algorthms Kent State Unversty Dept. of Math & Computer Scence LECT-6 Dynamc Programmng 2 Dynamc Programmng Dynamc Programmng, lke the dvde-and-conquer method, solves problems

More information

Priority queues and heaps Professors Clark F. Olson and Carol Zander

Priority queues and heaps Professors Clark F. Olson and Carol Zander Prorty queues and eaps Professors Clark F. Olson and Carol Zander Prorty queues A common abstract data type (ADT) n computer scence s te prorty queue. As you mgt expect from te name, eac tem n te prorty

More information

Steps for Computing the Dissimilarity, Entropy, Herfindahl-Hirschman and. Accessibility (Gravity with Competition) Indices

Steps for Computing the Dissimilarity, Entropy, Herfindahl-Hirschman and. Accessibility (Gravity with Competition) Indices Steps for Computng the Dssmlarty, Entropy, Herfndahl-Hrschman and Accessblty (Gravty wth Competton) Indces I. Dssmlarty Index Measurement: The followng formula can be used to measure the evenness between

More information

PBRT core. Announcements. pbrt. pbrt plug-ins

PBRT core. Announcements. pbrt. pbrt plug-ins Announcements PBRT core Dgtal Image Synthess Yung-Yu Chuang 9/27/2007 Please subscrbe the malng lst. Wndows complaton Debuggng n Wndows Doxygen (onlne, download or doxygen by yourself) HW#1 wll be assgned

More information

CS 534: Computer Vision Model Fitting

CS 534: Computer Vision Model Fitting CS 534: Computer Vson Model Fttng Sprng 004 Ahmed Elgammal Dept of Computer Scence CS 534 Model Fttng - 1 Outlnes Model fttng s mportant Least-squares fttng Maxmum lkelhood estmaton MAP estmaton Robust

More information

Last Time. University of British Columbia CPSC 111, Intro to Computation Alan J. Hu. Readings

Last Time. University of British Columbia CPSC 111, Intro to Computation Alan J. Hu. Readings University of British Columbia CPSC 111, Intro to Computation Alan J. Hu Writing a Simple Java Program Intro to Variables Readings Your textbook is Big Java (3rd Ed). This Week s Reading: Ch 2.1-2.5, Ch

More information

SENSITIVITY ANALYSIS IN LINEAR PROGRAMMING USING A CALCULATOR

SENSITIVITY ANALYSIS IN LINEAR PROGRAMMING USING A CALCULATOR SENSITIVITY ANALYSIS IN LINEAR PROGRAMMING USING A CALCULATOR Judth Aronow Rchard Jarvnen Independent Consultant Dept of Math/Stat 559 Frost Wnona State Unversty Beaumont, TX 7776 Wnona, MN 55987 aronowju@hal.lamar.edu

More information

Setup and Use. Version 3.7 2/1/2014

Setup and Use. Version 3.7 2/1/2014 Verson 3.7 2/1/2014 Setup and Use MaestroSoft, Inc. 1750 112th Avenue NE, Sute A200, Bellevue, WA 98004 425.688.0809 / 800.438.6498 Fax: 425.688.0999 www.maestrosoft.com Contents Text2Bd checklst 3 Preparng

More information

Dijkstra s Single Source Algorithm. All-Pairs Shortest Paths. Dynamic Programming Solution. Performance. Decision Sequence.

Dijkstra s Single Source Algorithm. All-Pairs Shortest Paths. Dynamic Programming Solution. Performance. Decision Sequence. All-Pars Shortest Paths Gven an n-vertex drected weghted graph, fnd a shortest path from vertex to vertex for each of the n vertex pars (,). Dstra s Sngle Source Algorthm Use Dstra s algorthm n tmes, once

More information

CSc 520 Principles of Programming Languages. Example Language Translators. What s a Language Translator??? 2: Translators

CSc 520 Principles of Programming Languages. Example Language Translators. What s a Language Translator??? 2: Translators What s a Compler??? Sprng 2005 2 CSc 520 Prncples of Programmng Languages 2: Translators Chrstan Collberg collberg@cs.arzona.edu Department of Computer Scence Unversty of Arzona Copyrght c 2004 Chrstan

More information

PYTHON IMPLEMENTATION OF VISUAL SECRET SHARING SCHEMES

PYTHON IMPLEMENTATION OF VISUAL SECRET SHARING SCHEMES PYTHON IMPLEMENTATION OF VISUAL SECRET SHARING SCHEMES Ruxandra Olmd Faculty of Mathematcs and Computer Scence, Unversty of Bucharest Emal: ruxandra.olmd@fm.unbuc.ro Abstract Vsual secret sharng schemes

More information

Building Java Programs. Introduction to Programming and Simple Java Programs

Building Java Programs. Introduction to Programming and Simple Java Programs Building Java Programs Introduction to Programming and Simple Java Programs 1 A simple Java program public class Hello { public static void main(string[] args) { System.out.println("Hello, world!"); code

More information

Sorting and Algorithm Analysis

Sorting and Algorithm Analysis Unt 7 Sortng and Algorthm Analyss Computer Scence S-111 Harvard Unversty Davd G. Sullvan, Ph.D. Sortng an Array of Integers 0 1 2 n-2 n-1 arr 15 7 36 40 12 Ground rules: sort the values n ncreasng order

More information

Programming Assignment Six. Semester Calendar. 1D Excel Worksheet Arrays. Review VBA Arrays from Excel. Programming Assignment Six May 2, 2017

Programming Assignment Six. Semester Calendar. 1D Excel Worksheet Arrays. Review VBA Arrays from Excel. Programming Assignment Six May 2, 2017 Programmng Assgnment Sx, 07 Programmng Assgnment Sx Larry Caretto Mechancal Engneerng 09 Computer Programmng for Mechancal Engneers Outlne Practce quz for actual quz on Thursday Revew approach dscussed

More information

Design and Analysis of Algorithms

Design and Analysis of Algorithms Desgn and Analyss of Algorthms Heaps and Heapsort Reference: CLRS Chapter 6 Topcs: Heaps Heapsort Prorty queue Huo Hongwe Recap and overvew The story so far... Inserton sort runnng tme of Θ(n 2 ); sorts

More information

Architecture Evolution

Architecture Evolution 2IMP25 Software Evoluton Archtecture Evoluton Alexander Serebrenk Announcements Remnder Assgnment 1 deadlne: Feb 19, 23:59. Do not wat tll 23:58 Guest lecture by Prof Vnju postponed to Feb 24. / SET /

More information

Tsinghua University at TAC 2009: Summarizing Multi-documents by Information Distance

Tsinghua University at TAC 2009: Summarizing Multi-documents by Information Distance Tsnghua Unversty at TAC 2009: Summarzng Mult-documents by Informaton Dstance Chong Long, Mnle Huang, Xaoyan Zhu State Key Laboratory of Intellgent Technology and Systems, Tsnghua Natonal Laboratory for

More information

Insertion Sort. Divide and Conquer Sorting. Divide and Conquer. Mergesort. Mergesort Example. Auxiliary Array

Insertion Sort. Divide and Conquer Sorting. Divide and Conquer. Mergesort. Mergesort Example. Auxiliary Array Inserton Sort Dvde and Conquer Sortng CSE 6 Data Structures Lecture 18 What f frst k elements of array are already sorted? 4, 7, 1, 5, 1, 16 We can shft the tal of the sorted elements lst down and then

More information

Introduction to Java Programming

Introduction to Java Programming Boaz Kantor Introduction to Computer Science, Fall semester 2009-2010 IDC Herzliya Welcome, geeks! Introduction to Java Programming Plan for today: 1. Before we begin.. 2. What is Java? 3. How to program?

More information

Expressions and Data Types CSC 121 Spring 2015 Howard Rosenthal

Expressions and Data Types CSC 121 Spring 2015 Howard Rosenthal Expressions and Data Types CSC 121 Spring 2015 Howard Rosenthal Lesson Goals Understand the basic constructs of a Java Program Understand how to use basic identifiers Understand simple Java data types

More information

Composition of UML Described Refactoring Rules *

Composition of UML Described Refactoring Rules * Composton of UML Descrbed Refactorng Rules * Slavsa Markovc Swss Federal Insttute of Technology Department of Computer Scence Software Engneerng Laboratory 05 Lausanne-EPFL Swtzerland e-mal: Slavsa.Markovc@epfl.ch

More information

9. BASIC programming: Control and Repetition

9. BASIC programming: Control and Repetition Am: In ths lesson, you wll learn: H. 9. BASIC programmng: Control and Repetton Scenaro: Moz s showng how some nterestng patterns can be generated usng math. Jyot [after seeng the nterestng graphcs]: Usng

More information

Report on On-line Graph Coloring

Report on On-line Graph Coloring 2003 Fall Semester Comp 670K Onlne Algorthm Report on LO Yuet Me (00086365) cndylo@ust.hk Abstract Onlne algorthm deals wth data that has no future nformaton. Lots of examples demonstrate that onlne algorthm

More information

Collaboratively Regularized Nearest Points for Set Based Recognition

Collaboratively Regularized Nearest Points for Set Based Recognition Academc Center for Computng and Meda Studes, Kyoto Unversty Collaboratvely Regularzed Nearest Ponts for Set Based Recognton Yang Wu, Mchhko Mnoh, Masayuk Mukunok Kyoto Unversty 9/1/013 BMVC 013 @ Brstol,

More information

Computer Components. Software{ User Programs. Operating System. Hardware

Computer Components. Software{ User Programs. Operating System. Hardware Computer Components Software{ User Programs Operating System Hardware What are Programs? Programs provide instructions for computers Similar to giving directions to a person who is trying to get from point

More information

High-Boost Mesh Filtering for 3-D Shape Enhancement

High-Boost Mesh Filtering for 3-D Shape Enhancement Hgh-Boost Mesh Flterng for 3-D Shape Enhancement Hrokazu Yagou Λ Alexander Belyaev y Damng We z Λ y z ; ; Shape Modelng Laboratory, Unversty of Azu, Azu-Wakamatsu 965-8580 Japan y Computer Graphcs Group,

More information

Polyhedral Compilation Foundations

Polyhedral Compilation Foundations Polyhedral Complaton Foundatons Lous-Noël Pouchet pouchet@cse.oho-state.edu Dept. of Computer Scence and Engneerng, the Oho State Unversty Feb 8, 200 888., Class # Introducton: Polyhedral Complaton Foundatons

More information

Java is a high-level programming language originally developed by Sun Microsystems and released in Java runs on a variety of

Java is a high-level programming language originally developed by Sun Microsystems and released in Java runs on a variety of Java is a high-level programming language originally developed by Sun Microsystems and released in 1995. Java runs on a variety of platforms, such as Windows, Mac OS, and the various versions of UNIX.

More information

Key Differences Between Python and Java

Key Differences Between Python and Java Python Python supports many (but not all) aspects of object-oriented programming; but it is possible to write a Python program without making any use of OO concepts. Python is designed to be used interpretively.

More information

CHAPTER 4. Applications of Boolean Algebra/ Minterm and Maxterm Expansions

CHAPTER 4. Applications of Boolean Algebra/ Minterm and Maxterm Expansions Fundaentals o Logc Desgn hap. 4 HAPTER 4 /8 Applcatons o Boolean Algebra/ Mnter and Maxter Expansons Ths chapter n the book ncludes: Objectves Study Gude 4. onverson o Englsh Sentences to Boolean Equatons

More information

Computer Components. Software{ User Programs. Operating System. Hardware

Computer Components. Software{ User Programs. Operating System. Hardware Computer Components Software{ User Programs Operating System Hardware What are Programs? Programs provide instructions for computers Similar to giving directions to a person who is trying to get from point

More information

Alignment Results of SOBOM for OAEI 2010

Alignment Results of SOBOM for OAEI 2010 Algnment Results of SOBOM for OAEI 2010 Pegang Xu, Yadong Wang, Lang Cheng, Tany Zang School of Computer Scence and Technology Harbn Insttute of Technology, Harbn, Chna pegang.xu@gmal.com, ydwang@ht.edu.cn,

More information

GSLM Operations Research II Fall 13/14

GSLM Operations Research II Fall 13/14 GSLM 58 Operatons Research II Fall /4 6. Separable Programmng Consder a general NLP mn f(x) s.t. g j (x) b j j =. m. Defnton 6.. The NLP s a separable program f ts objectve functon and all constrants are

More information

Expressions and Data Types CSC 121 Fall 2015 Howard Rosenthal

Expressions and Data Types CSC 121 Fall 2015 Howard Rosenthal Expressions and Data Types CSC 121 Fall 2015 Howard Rosenthal Lesson Goals Understand the basic constructs of a Java Program Understand how to use basic identifiers Understand simple Java data types and

More information

2 rd class Department of Programming. OOP with Java Programming

2 rd class Department of Programming. OOP with Java Programming 1. Structured Programming and Object-Oriented Programming During the 1970s and into the 80s, the primary software engineering methodology was structured programming. The structured programming approach

More information

Compiler Design. Spring Register Allocation. Sample Exercises and Solutions. Prof. Pedro C. Diniz

Compiler Design. Spring Register Allocation. Sample Exercises and Solutions. Prof. Pedro C. Diniz Compler Desgn Sprng 2014 Regster Allocaton Sample Exercses and Solutons Prof. Pedro C. Dnz USC / Informaton Scences Insttute 4676 Admralty Way, Sute 1001 Marna del Rey, Calforna 90292 pedro@s.edu Regster

More information

index.pdf March 20,

index.pdf March 20, ndex.pdf March 20, 20 ITI 2. Introducton to omputng II Impementaton -2-: usng an nner cass We use an nner cass to create the terators: Marce Turcotte Schoo of Informaton Technoogy and Engneerng Iterator

More information

Introduction to Programming Using Java (98-388)

Introduction to Programming Using Java (98-388) Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;

More information

Load Balancing for Hex-Cell Interconnection Network

Load Balancing for Hex-Cell Interconnection Network Int. J. Communcatons, Network and System Scences,,, - Publshed Onlne Aprl n ScRes. http://www.scrp.org/journal/jcns http://dx.do.org/./jcns.. Load Balancng for Hex-Cell Interconnecton Network Saher Manaseer,

More information

Learning the Kernel Parameters in Kernel Minimum Distance Classifier

Learning the Kernel Parameters in Kernel Minimum Distance Classifier Learnng the Kernel Parameters n Kernel Mnmum Dstance Classfer Daoqang Zhang 1,, Songcan Chen and Zh-Hua Zhou 1* 1 Natonal Laboratory for Novel Software Technology Nanjng Unversty, Nanjng 193, Chna Department

More information