Outline. CIS 110: Introduction to Computer Programming. Review: Interactive Sum. More Cumulative Algorithms. Interactive Sum Trace (2)
|
|
- Cassandra O’Connor’
- 6 years ago
- Views:
Transcription
1 Outlne CIS 110: Introducton to Computer Programmng More on Cumulatve Algorthms Processng Text Tacklng Programmng Problems Lecture 11 Text Processng and More On Desgn ( ) 10/17/2011 CIS 110 (11fa) - Unversty of Pennsylvana 1 10/17/2011 CIS 110 (11fa) - Unversty of Pennsylvana 2 Revew: Interactve Sum More Cumulatve Algorthms 10/17/2011 CIS 110 (11fa) - Unversty of Pennsylvana 3 Can you wrte a program that computes the sum of numbers from 0 to the user's nput mnus 1? Scanner n = new Scanner(System.n); System.out.prnt("n? "); nt n = n.nextint(); System.out.prntln(); Some storage declared outsde the loop. nt sum = 0; for (nt = 0; < n; ++) { sum += ; Update the storage nsde of the loop. System.out.prntln( "Sum of 1 to " + Use the updated storage after the loop. 10/17/2011 CIS 110 (11fa) - Unversty of Pennsylvana 4 Interactve Sum Trace (1) Interactve Sum Trace (2) n 10/17/2011 CIS 110 (11fa) - Unversty of Pennsylvana 5 10/17/2011 CIS 110 (11fa) - Unversty of Pennsylvana 6 CIS 110 (11fa) - Unversty of Pennsylvana 1
2 Interactve Sum Trace (3) Interactve Sum Trace (4) n n n 5 10/17/2011 CIS 110 (11fa) - Unversty of Pennsylvana 7 10/17/2011 CIS 110 (11fa) - Unversty of Pennsylvana 8 Interactve Sum Trace (5) Interactve Sum Trace (6) n n 5 n n 5 sum 0 10/17/2011 CIS 110 (11fa) - Unversty of Pennsylvana 9 10/17/2011 CIS 110 (11fa) - Unversty of Pennsylvana 10 Interactve Sum Trace (7) Interactve Sum Trace (8) 0 0 n n 5 sum 0 n n 5 sum 0 10/17/2011 CIS 110 (11fa) - Unversty of Pennsylvana 11 10/17/2011 CIS 110 (11fa) - Unversty of Pennsylvana 12 CIS 110 (11fa) - Unversty of Pennsylvana 2
3 Interactve Sum Trace (9) Interactve Sum Trace (10) 1 1 n n 5 sum 0 n n 5 sum 0 10/17/2011 CIS 110 (11fa) - Unversty of Pennsylvana 13 10/17/2011 CIS 110 (11fa) - Unversty of Pennsylvana 14 Interactve Sum Trace (11) Interactve Sum Trace (12) 1 2 n n 5 sum 1 n n 5 sum 1 10/17/2011 CIS 110 (11fa) - Unversty of Pennsylvana 15 10/17/2011 CIS 110 (11fa) - Unversty of Pennsylvana 16 Interactve Sum Trace (13) Interactve Sum Trace (13) 2 3 n n 5 sum 3 n n 5 sum 3 10/17/2011 CIS 110 (11fa) - Unversty of Pennsylvana 17 10/17/2011 CIS 110 (11fa) - Unversty of Pennsylvana 18 CIS 110 (11fa) - Unversty of Pennsylvana 3
4 Interactve Sum Trace (14) Interactve Sum Trace (15) 3 4 n n 5 sum 6 n n 5 sum 6 10/17/2011 CIS 110 (11fa) - Unversty of Pennsylvana 19 10/17/2011 CIS 110 (11fa) - Unversty of Pennsylvana 20 Interactve Sum Trace (16) Interactve Sum Trace (17) 4 5 n n 5 sum 10 n n 5 sum 10 10/17/2011 CIS 110 (11fa) - Unversty of Pennsylvana 21 10/17/2011 CIS 110 (11fa) - Unversty of Pennsylvana 22 Interactve Sum Trace (18) n n 5 sum 10 Cumulatve Algorthms and Condtonals Problem: calculate the mnmum of 10 numbers entered by the user. publc statc nt promptfornumber(scanner n, nt ) { System.out.prnt("Enter number " + + ": "); return n.nextint(); publc statc vod man(strng[] args) { Scanner n = new Scanner(System.n); nt mn = promptfornumber(n, 1); // Storage for (nt = 2; <= 10; ++) { nt num = promptfornumber(n, ); // Modfy storage f (num < mn) { mn = num; // Use storage System.out.prntln("The mnmum s " + mn + "."); 10/17/2011 CIS 110 (11fa) - Unversty of Pennsylvana 23 10/17/2011 CIS 110 (11fa) - Unversty of Pennsylvana 24 CIS 110 (11fa) - Unversty of Pennsylvana 4
5 Recall: charat(ndex) Text Processng Scanner n = new Scanner(System.n); Strng lne = n.nextlne(); for (nt = 0; < lne.length(); ++) { // charat() returns the th character of the strng // Remember strng ndces start at 0... System.out.prntln(lne.charAt()); 10/17/2011 CIS 110 (11fa) - Unversty of Pennsylvana 25 10/17/2011 CIS 110 (11fa) - Unversty of Pennsylvana 26 The char Type A prmtve that represents a sngle character. Represented as a 16-bt nteger (character value). All our prmtve operatons on numbers apply! char c1 = 'c'; f (c1 == 'c') { System.out.prntln(c1 + " s c!"); // Int + Char = Int whch s 32 bts, so we need to // cast to tell the compler we don't mnd the truncaton. char c2 = (char) (c1 + 5); System.out.prntln("5 chars from " + c1 + " s " + c2); // Tests to see f c2 s a lowercase number. f (c2 >= 'a' c2 <= 'z') { System.out.prntln(c2 + " s between 'a' and 'z'!"); 10/17/2011 CIS 110 (11fa) - Unversty of Pennsylvana 27 The Character class Helpful statc methods for dealng wth chars. nt fve = Character.getNumercValue('5'); System.out.prntln("The number value of 5 s " + fve); System.out.prntln("Is 6 a dgt? " + Character.sDgt('6')); System.out.prntln("Is q a letter? " + Character.sLetter('q')); System.out.prntln("Is z lowercase? " + Character.sLowerCase('z')); System.out.prntln("Is R uppercase? " + Character.sUpperCase('R')); System.out.prntln("Lowercase Z s " + Character.toLowerCase('Z')); System.out.prntln("Uppercase a s " + Character.toUpperCase('a')); 10/17/2011 CIS 110 (11fa) - Unversty of Pennsylvana 28 Cumulatve Text Algorthms Smlar to our numerc cumulatve algorthms. // Echos the lne of text, alternatng captal case of the nput. Scanner n = new Scanner(System.n); System.out.prnt("Enter a lne of text: "); Strng lne = n.nextlne(); Strng result = ""; for (nt = 0; < lne.length(); ++) { char letter = lne.charat(); f ( % 2 == 0) { letter = Character.toUpperCase(letter); result += letter; System.out.prntln(result); 10/17/2011 CIS 110 (11fa) - Unversty of Pennsylvana 29 System.out.prntf An alternatve to prntln/prnt that lets you format the output. System.out.prntf("Example of prntf: %d %.2f %s", 12, 1.241, "Chowder"); > Example of prntf: Chowder Specfers have the form: %<formattng><type> Need to provde one argument per format specfer. They are consumed n-order. A format specfer. A placeholder for a thng to prnt. See p. 260 of the book for more nformaton about format specfers. 10/17/2011 CIS 110 (11fa) - Unversty of Pennsylvana 30 CIS 110 (11fa) - Unversty of Pennsylvana 5
6 System.out.prntf (example) Scanner n = new Scanner(System.n); for (nt = 0; < 3; ++) { System.out.prnt("Enter the employee's name: "); Strng name = n.nextlne(); System.out.prnt("Enter the employee's salary: "); double salary = n.nextdouble(); System.out.prntf("%10s -> %6.2f\n", name, salary); n.nextlne();// flush the buffer Tacklng Program Problems Enter the employee's name: Joe Enter the employee's salary: Joe -> Enter the employee's name: Lamont Enter the employee's salary: Lamont -> Enter the employee's name: Fred Enter the employee's salary: Fred -> See PalndromeChecker.java 10/17/2011 CIS 110 (11fa) - Unversty of Pennsylvana 31 10/17/2011 CIS 110 (11fa) - Unversty of Pennsylvana 32 Sample Problem Problem: wrte a program that reads n a Strng from the user, checks to see f that Strng s a palndrome, and nforms the user of the results of the check. Example output > Enter a strng to check: > abba > The reverse of the lne s: abba > The lne s a palndrome! Our Methodology 1. Try some example nputs to get a feel for the problem. 2. Start wth a skeleton of the soluton. 3. Decompose the problem nto sub-problems. 4. Make helper methods to solve the subproblems. 5. Use those helper methods to solve your man problem. 10/17/2011 CIS 110 (11fa) - Unversty of Pennsylvana 33 10/17/2011 CIS 110 (11fa) - Unversty of Pennsylvana 34 CIS 110 (11fa) - Unversty of Pennsylvana 6
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 informationNews. 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 informationTerminal 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 informationPass 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 informationA Taste of Java and Object-Oriented Programming
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, www.ntro2cs.com slde 1 Lecture
More informationProgramming 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 informationCMPS 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 informationNotes 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 informationHigh 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 informationParallelism 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 informationKent 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 informationProgramming 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 informationEsc101 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 informationIntroduction 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 informationKFUPM. SE301: Numerical Methods Topic 8 Ordinary Differential Equations (ODEs) Lecture (Term 101) Section 04. Read
SE3: Numercal Metods Topc 8 Ordnar Dfferental Equatons ODEs Lecture 8-36 KFUPM Term Secton 4 Read 5.-5.4 6-7- C ISE3_Topc8L Outlne of Topc 8 Lesson : Introducton to ODEs Lesson : Talor seres metods Lesson
More informationEfficient Distributed File System (EDFS)
Effcent Dstrbuted Fle System (EDFS) (Sem-Centralzed) Debessay(Debsh) Fesehaye, Rahul Malk & Klara Naherstedt Unversty of Illnos-Urbana Champagn Contents Problem Statement, Related Work, EDFS Desgn Rate
More informationFor 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 informationLoad 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 informationParallel Numerics. 1 Preconditioning & Iterative Solvers (From 2016)
Technsche Unverstät München WSe 6/7 Insttut für Informatk Prof. Dr. Thomas Huckle Dpl.-Math. Benjamn Uekermann Parallel Numercs Exercse : Prevous Exam Questons Precondtonng & Iteratve Solvers (From 6)
More informationSequential 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 informationFinal Exam. CSE Section M, Winter p. 1 of 16. Family Name: Given Name(s): Student Number:
Fna Exam CSE 1020 3.0 Secton M, Wnter 2010 p. 1 o 16 Famy Name: Gven Name(s): Student Numer: Gudenes and Instructons: 1. Ths s a 90-mnute exam. You can use the textook, ut no eectronc ads such as cacuators,
More informationHarvard 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 informationOverview. 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 informationLoop 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 informationTsinghua 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 informationConditional Speculative Decimal Addition*
Condtonal Speculatve Decmal Addton Alvaro Vazquez and Elsardo Antelo Dep. of Electronc and Computer Engneerng Unv. of Santago de Compostela, Span Ths work was supported n part by Xunta de Galca under grant
More informationAn 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 informationComputer 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 informationCSCI 104 Sorting Algorithms. Mark Redekopp David Kempe
CSCI 104 Sortng Algorthms Mark Redekopp Davd Kempe Algorthm Effcency SORTING 2 Sortng If we have an unordered lst, sequental search becomes our only choce If we wll perform a lot of searches t may be benefcal
More informationComputational Expression
Computational Expression Variables, Primitive Data Types, Expressions Janyl Jumadinova 28-30 January, 2019 Janyl Jumadinova Computational Expression 28-30 January, 2019 1 / 17 Variables Variable is a name
More informationThis chapter discusses aspects of heat conduction. The equilibrium heat conduction on a rod. In this chapter, Arrays will be discussed.
1 Heat Flow n a Rod Ths chapter dscusses aspects of heat conducton. The equlbrum heat conducton on a rod. In ths chapter, Arrays wll be dscussed. Arrays provde a mechansm for declarng and accessng several
More informationOutline. Midterm Review. Declaring Variables. Main Variable Data Types. Symbolic Constants. Arithmetic Operators. Midterm Review March 24, 2014
Mdterm Revew March 4, 4 Mdterm Revew Larry Caretto Mechancal Engneerng 9 Numercal Analyss of Engneerng Systems March 4, 4 Outlne VBA and MATLAB codng Varable types Control structures (Loopng and Choce)
More informationCompiler 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 informationOracle 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 informationAssembler. 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 informationAssignment # 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 informationCS240: Programming in C. Lecture 12: Polymorphic Sorting
CS240: Programmng n C ecture 12: Polymorphc Sortng Sortng Gven a collecton of tems and a total order over them, sort the collecton under ths order. Total order: every tem s ordered wth respect to every
More informationBrave 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 informationprintf( Please enter another number: ); scanf( %d, &num2);
CIT 593 Intro to Computer Systems Lecture #13 (11/1/12) Now that we've looked at how an assembly language program runs on a computer, we're ready to move up a level and start working with more powerful
More informationK-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 informationVirtual 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 informationDijkstra 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 informationBIN XIA et al: AN IMPROVED K-MEANS ALGORITHM BASED ON CLOUD PLATFORM FOR DATA MINING
An Improved K-means Algorthm based on Cloud Platform for Data Mnng Bn Xa *, Yan Lu 2. School of nformaton and management scence, Henan Agrcultural Unversty, Zhengzhou, Henan 450002, P.R. Chna 2. College
More informationVectorization in the Polyhedral Model
Vectorzaton n the Polyhedral Model Lous-Noël Pouchet pouchet@cse.oho-state.edu Dept. of Computer Scence and Engneerng, the Oho State Unversty October 200 888. Introducton: Overvew Vectorzaton: Detecton
More information9. 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 informationLecture 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 informationSorting 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 informationComplex 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 informationCS1100 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 informationArrays. Loops + arrays: challenge problem. Arrays (II) An array is a set of variables of the same type accessed by their index.
Arrays Arrays (Savitch, Chapter 7) TOPICS Array Basics Array Loops Array Programming An array is a set of variables of the same type accessed by their index int[] day = new int[4]; 31 28 31 30 day[0] day[2]
More informationProblem Set 3 Solutions
Introducton to Algorthms October 4, 2002 Massachusetts Insttute of Technology 6046J/18410J Professors Erk Demane and Shaf Goldwasser Handout 14 Problem Set 3 Solutons (Exercses were not to be turned n,
More informationDijkstra s Single Source Algorithm. All-Pairs Shortest Paths. Dynamic Programming Solution. Performance
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 (,). Dkstra s Sngle Source Algorthm Use Dkstra s algorthm n tmes,
More informationELEC 377 Operating Systems. Week 6 Class 3
ELEC 377 Operatng Systems Week 6 Class 3 Last Class Memory Management Memory Pagng Pagng Structure ELEC 377 Operatng Systems Today Pagng Szes Vrtual Memory Concept Demand Pagng ELEC 377 Operatng Systems
More informationConstants. Why Use Constants? main Method Arguments. CS256 Computer Science I Kevin Sahr, PhD. Lecture 25: Miscellaneous
CS256 Computer Science I Kevin Sahr, PhD Lecture 25: Miscellaneous 1 main Method Arguments recall the method header of the main method note the argument list public static void main (String [] args) we
More informationCollaboratively 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 informationMULTISPECTRAL IMAGES CLASSIFICATION BASED ON KLT AND ATR AUTOMATIC TARGET RECOGNITION
MULTISPECTRAL IMAGES CLASSIFICATION BASED ON KLT AND ATR AUTOMATIC TARGET RECOGNITION Paulo Quntlano 1 & Antono Santa-Rosa 1 Federal Polce Department, Brasla, Brazl. E-mals: quntlano.pqs@dpf.gov.br and
More informationCourse 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 informationMultiple optimum values
1.204 Lecture 22 Unconstraned nonlnear optmzaton: Amoeba BFGS Lnear programmng: Glpk Multple optmum values A B C G E Z X F Y D X 1 X 2 Fgure by MIT OpenCourseWare. Heurstcs to deal wth multple optma: Start
More informationINTEGER PROGRAMMING MODELING FOR THE CHINESE POSTMAN PROBLEMS
INTEGER PROGRAMMING MODELING FOR THE CHINESE POSTMAN PROBLEMS ABSTRACT Feng Junwen School of Economcs and Management, Nanng Unversty of Scence and Technology, Nanng, 2009, Chna As far as the tradtonal
More informationStrings. Piech, CS106A, Stanford University
Strngs Learnng Goals 1. Understand chars and Strngs 2. Wrte methods actng on Strngs Text Applcatons ow s text represented? The varable type Strng Text s stored usng the varable type Strng. A Strng s a
More informationArray transposition in CUDA shared memory
Array transposton n CUDA shared memory Mke Gles February 19, 2014 Abstract Ths short note s nspred by some code wrtten by Jeremy Appleyard for the transposton of data through shared memory. I had some
More informationExercise 1.1 Hello world
Exercise 1.1 Hello world The goal of this exercise is to verify that computer and compiler setup are functioning correctly. To verify that your setup runs fine, compile and run the hello world example
More informationEstimation of Parallel Complexity with Rewriting Techniques
Estmaton of Parallel Complexty wth Rewrtng Technques Chrstophe Alas, Carsten Fuhs, Laure Gonnord INRIA & LIP (UMR CNRS/ENS Lyon/UCB Lyon1/INRIA), Lyon, France, chrstophe.alas@ens-lyon.fr Brkbeck, Unversty
More informationIntroduction to C. Sami Ilvonen Petri Nikunen. Oct 6 8, CSC IT Center for Science Ltd, Espoo. int **b1, **b2;
Sami Ilvonen Petri Nikunen Introduction to C Oct 6 8, 2015 @ CSC IT Center for Science Ltd, Espoo int **b1, **b2; /* Initialise metadata */ board_1->height = height; board_1->width = width; board_2->height
More informationChapter 6 Methods. Liang, Introduction to Java Programming, Tenth Edition, Global Edition. Pearson Education Limited
Chapter 6 Methods Liang, Introduction to Java Programming, Tenth Edition, Global Edition. Pearson Education Limited 2015 1 Opening Problem Find the sum of integers from 1 to 10, from 20 to 30, and from
More informationkccvoip.com basic voip training NAT/PAT extract 2008
kccvop.com basc vop tranng NAT/PAT extract 28 As we have seen n the prevous sldes, SIP and H2 both use addressng nsde ther packets to rely nformaton. Thnk of an envelope where we place the addresses of
More informationSolving two-person zero-sum game by Matlab
Appled Mechancs and Materals Onlne: 2011-02-02 ISSN: 1662-7482, Vols. 50-51, pp 262-265 do:10.4028/www.scentfc.net/amm.50-51.262 2011 Trans Tech Publcatons, Swtzerland Solvng two-person zero-sum game by
More informationThe Codesign Challenge
ECE 4530 Codesgn Challenge Fall 2007 Hardware/Software Codesgn The Codesgn Challenge Objectves In the codesgn challenge, your task s to accelerate a gven software reference mplementaton as fast as possble.
More informationCONCURRENT OPTIMIZATION OF MULTI RESPONCE QUALITY CHARACTERISTICS BASED ON TAGUCHI METHOD. Ümit Terzi*, Kasım Baynal
CONCURRENT OPTIMIZATION OF MUTI RESPONCE QUAITY CHARACTERISTICS BASED ON TAGUCHI METHOD Ümt Terz*, Kasım Baynal *Department of Industral Engneerng, Unversty of Kocael, Vnsan Campus, Kocael, Turkey +90
More informationMidterms 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 informationOn 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 information2D Raster Graphics. Integer grid Sequential (left-right, top-down) scan. Computer Graphics
2D Graphcs 2D Raster Graphcs Integer grd Sequental (left-rght, top-down scan j Lne drawng A ver mportant operaton used frequentl, block dagrams, bar charts, engneerng drawng, archtecture plans, etc. curves
More informationFull file at
Java Programming: From Problem Analysis to Program Design, 3 rd Edition 2-1 Chapter 2 Basic Elements of Java At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class
More informationCS-201 Introduction to Programming with Java
CS-201 Introduction to Programming with Java California State University, Los Angeles Computer Science Department Lecture X: Methods II Passing Arguments Passing Arguments methods can accept outside information
More informationCS 268: Lecture 8 Router Support for Congestion Control
CS 268: Lecture 8 Router Support for Congeston Control Ion Stoca Computer Scence Dvson Department of Electrcal Engneerng and Computer Scences Unversty of Calforna, Berkeley Berkeley, CA 9472-1776 Router
More informationNGPM -- A NSGA-II Program in Matlab
Verson 1.4 LIN Song Aerospace Structural Dynamcs Research Laboratory College of Astronautcs, Northwestern Polytechncal Unversty, Chna Emal: lsssswc@163.com 2011-07-26 Contents Contents... 1. Introducton...
More informationMidterms 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 informationFull file at
Java Programming, Fifth Edition 2-1 Chapter 2 Using Data within a Program At a Glance Instructor s Manual Table of Contents Overview Objectives Teaching Tips Quick Quizzes Class Discussion Topics Additional
More informationAssembler. 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 informationOPL: 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 informationSorting. Sorted Original. index. index
1 Unt 16 Sortng 2 Sortng Sortng requres us to move data around wthn an array Allows users to see and organze data more effcently Behnd the scenes t allows more effectve searchng of data There are MANY
More informationIntroduction to Programming, Aug-Dec 2006
Introduction to Programming, Aug-Dec 2006 Lecture 3, Friday 11 Aug 2006 Lists... We can implicitly decompose a list into its head and tail by providing a pattern with two variables to denote the two components
More informationArithmetic and IO. 25 August 2017
Arithmetic and IO 25 August 2017 Submissions you can submit multiple times to the homework dropbox file name: uppercase first letter, Yourlastname0829.java the system will use the last submission before
More informationToday Using Fourier-Motzkin elimination for code generation Using Fourier-Motzkin elimination for determining schedule constraints
Fourer Motzkn Elmnaton Logstcs HW10 due Frday Aprl 27 th Today Usng Fourer-Motzkn elmnaton for code generaton Usng Fourer-Motzkn elmnaton for determnng schedule constrants Unversty Fourer-Motzkn Elmnaton
More informationIntroduction to Geometrical Optics - a 2D ray tracing Excel model for spherical mirrors - Part 2
Introducton to Geometrcal Optcs - a D ra tracng Ecel model for sphercal mrrors - Part b George ungu - Ths s a tutoral eplanng the creaton of an eact D ra tracng model for both sphercal concave and sphercal
More informationSetup 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 informationChapter 2 Using Data. Instructor s Manual Table of Contents. At a Glance. Overview. Objectives. Teaching Tips. Quick Quizzes. Class Discussion Topics
Java Programming, Sixth Edition 2-1 Chapter 2 Using Data At a Glance Instructor s Manual Table of Contents Overview Objectives Teaching Tips Quick Quizzes Class Discussion Topics Additional Projects Additional
More informationParallel matrix-vector multiplication
Appendx A Parallel matrx-vector multplcaton The reduced transton matrx of the three-dmensonal cage model for gel electrophoress, descrbed n secton 3.2, becomes excessvely large for polymer lengths more
More information124 Chapter 8. Case Study: A Memory Component ndcatng some error condton. An exceptonal return of a value e s called rasng excepton e. A return s ssue
Chapter 8 Case Study: A Memory Component In chapter 6 we gave the outlne of a case study on the renement of a safe regster. In ths chapter wepresent the outne of another case study on persstent communcaton;
More informationCS-201 Introduction to Programming with Java
CS-201 Introduction to Programming with Java California State University, Los Angeles Computer Science Department Lecture IX: Methods Introduction method: construct for grouping statements together to
More informationINCOMPETE DATA IN FUZZY INFERENCE SYSTEM
XI Conference "Medcal Informatcs & Technologes" - 26 mssng data, ncomplete nformaton fuzz rules, fuzz operators, classfer Slwa POŚPIECH-KURKOWSKA * INCOMPETE DATA IN FUZZY INFERENCE SYSTEM The paper descrbes
More informationSorting 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 informationLLVM 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 informationPositive Semi-definite Programming Localization in Wireless Sensor Networks
Postve Sem-defnte Programmng Localzaton n Wreless Sensor etworks Shengdong Xe 1,, Jn Wang, Aqun Hu 1, Yunl Gu, Jang Xu, 1 School of Informaton Scence and Engneerng, Southeast Unversty, 10096, anjng Computer
More informationNachos 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 informationChapter 6: Methods. Objectives 9/21/18. Opening Problem. Problem. Problem. Solution. CS1: Java Programming Colorado State University
Opening Problem Chapter 6: Methods Find the sum of integers from 1 to 10, from 20 to 30, and from 35 to 45, respectively CS1: Java Programming Colorado State University Original slides by Daniel Liang
More informationThe Greedy Method. Outline and Reading. Change Money Problem. Greedy Algorithms. Applications of the Greedy Strategy. The Greedy Method Technique
//00 :0 AM Outlne and Readng The Greedy Method The Greedy Method Technque (secton.) Fractonal Knapsack Problem (secton..) Task Schedulng (secton..) Mnmum Spannng Trees (secton.) Change Money Problem Greedy
More informationThe example below contains two doors and no floor level obstacles. Your panel calculator should now look something like this: 2,400
Step 1: A r c h t e c t u r a l H e a t n g o begn wth you must prepare a smple drawng for each room n whch you wsh to nstall our Heat Profle Skrtng Heatng System. You certanly don't need to be Pcasso,
More informationSmoothing Spline ANOVA for variable screening
Smoothng Splne ANOVA for varable screenng a useful tool for metamodels tranng and mult-objectve optmzaton L. Rcco, E. Rgon, A. Turco Outlne RSM Introducton Possble couplng Test case MOO MOO wth Game Theory
More informationSection 2.2 Your First Program in Java: Printing a Line of Text
Chapter 2 Introduction to Java Applications Section 2.2 Your First Program in Java: Printing a Line of Text 2.2 Q1: End-of-line comments that should be ignored by the compiler are denoted using a. Two
More information