CMPS 10 Introduction to Computer Science Lecture Notes
|
|
- Janel Poole
- 6 years ago
- Views:
Transcription
1 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 deal for ths purpose. We need a more precse notaton to present algorthms that s not subject to dfferng nterpretatons. At the other extreme formal programmng languages (such as C, C++, Java, Perl, ADA, Python, etc.) are very nflexble n ther syntax, and requre much attenton to detal. hese detals may be rrelevant n the ntal desgn phases of an algorthm. Instead we use an nformal and flexble language called pseudo-code whch uses Englsh language constructs and conventons modeled to look lke commands avalable n most computer languages. Detaled & Exact Expressve & Abstract Computer Languages Pseudo-Code Natural Languages Pseudo-code s a language n whch all necessary operatons can be expressed, but whch s ndependent of any computer language, or of any computer for that matter. Sequental Operatons are of three basc knds: computaton, nput, and output. he nstructon for performng a calculaton and storng the result s wrtten as varable expresson hs nstructon tells the computng agent to evaluate the expresson on the rght and assgn ts value to the varable on the left. he left arrow n ths context s called the assgnment operator. Example c a + b + carry Example x b+ b 4ac a Unless otherwse stated, we wll assume that the computng agent s at least as capable as any scentfc calculator, so that the above expressons are consdered prmtve operatons. 5
2 Input and output operatons allow the computng agent to receve data values from, and send results to the outsde world, whch we also call the user. Computng Agent Input Output Outsde World he operatons used for nput and output are get and prnt respectvely. Example get x Example prnt x Example prnt x + 5 get varable prnt varable prnt expresson ext to be prnted wll be placed n sngle quotes. Example prnt error: dvson by zero Example prnt the value of x s: x and the value of y s: y An algorthm whch uses only sequental operatons s sometmes called a straght lne algorthm. Example ) get a, b, c, d ) sum a + b+ c+ d ) average sum / 4 4) prnt average What does ths algorthm do? Condtonal operatons (also called branchng operatons) are expressed usng the f statement or the f-else statement. he f statement s wrtten as f condton do somethng do somethng do somethng do somethng 6
3 In ths structure condton stands for a logcal (or Boolean) expresson,.e. an expresson that can be evaluated as true or false. If condton s true, then the ndented lnes are executed, followed by the unndented lnes. If on the other hand condton s false, then the ndented lnes are skpped, and executon pcks up at the next unndented lne. he ndented commands are known as the true branch of the condtonal. An f statement may also come wth an accompanyng else clause. f condton do somethng do somethng else do somethng do somethng do somethng If condton s true, then the frst group of ndented nstructons s executed, and the second group s skpped, followed by the next unndented nstructon. If condton s false, then the frst group s skpped, and the second group of ndented nstructons s executed, followed by the next unndented nstructon. In ths structure the second group of ndented nstructons s known as the false branch of the condtonal, whle the frst group s know as the true branch, as before. Example What does the followng algorthm do? ) get a, b ) f b = 0 ) prnt 'Error: dvson by zero' 4) else 5) quotent a / b 6) prnt quotent 7) stop Iteratve operatons (also called loops) wll be expressed n pseudo-code through three commands: whle, do-whle, and for. whle condton do somethng do somethng do somethng Frst condton s tested, and f found to be true, the ndented lnes (called the loop body) s executed. he condton s tested agan, and f found to be true, the loop body s executed agan. hs process contnues untl the condton s found to be false, n whch case executon pcks up at the next unndented lne. he whle loop condton s sometmes called a loop repetton condton snce the loop body repeats only so long as ths logcal expresson s true. 7
4 Example What does the followng algorthm do? ) response 'yes' ) whle response = 'yes' ) get a, b 4) f b = 0 5) prnt 'Error: dvson by zero' 6) else 7) prnt a / b 8) prnt 'Do you wsh to contnue?' 9) get response 0) stop he do-whle loop structure puts the loop repetton condton after the loop body. do do somethng do somethng whle condton do somethng Frst the loop body, whch conssts of just those lnes that are ndented, s executed. hen the condton s tested, and f found to be true, the loop body s repeated. We contnue executng the loop body untl condton becomes false, then executon pcks up at the next unndented lne after whle. he loop repetton condton s called a post test condton n ths case snce t s tested after the frst executon of the loop body. he condton n the whle loop on the other hand s called a pre test condton, snce t s tested before the frst executon of the loop body. Example Notce that the loop body n ths example s dentcal to the one n the precedng example. ) do ) get a, b ) f b = 0 4) prnt "Error: dvson by zero' 5) else 6) prnt a / b 7) prnt 'Do you wsh to contnue?' 8) get response 9) whle response = 'yes' 0) stop We often encounter whle loops wth the followng general structure Intalze the loop control varable whle n est the loop repetton condton do somethng wth + Increment the loop control varable 8
5 We can do these three steps, ntalze loop control varable, test loop repetton condton, and ncrement loop control varable, more succnctly wth the for loop structure below, whch s equvalent to the precedng whle loop. for to n do somethng wth Example Here are two equvalent algorthms, one uses a whle loop, and the other uses an equvalent for loop. A trace of both algorthms would be dentcal. ) ) whle 5 ) prnt 4) + 5) stop ) for to 5 ) prnt ) stop It has been proved that one can represent any vald algorthm wth the operatons so far descrbed. We now consder some well known algorthms whch perform certan basc tasks n computer scence. Example Consder the problem of lookng up a name and correspondng telephone number n a drectory NAE Names Numbers N N N N N n n We assume that the names are n no partcular order (.e. not necessarly n alphabetcal order) so that we must look at each name n successon. If we fnd a name N whch matches our target NAE, we return the correspondng number. If no effect. We call ths algorthm Sequental Search. N s a match, we prnt a message to that Input: n (the number of names n the lst), N, L, N and n, L,n (the lst of names and correspondng telephone numbers), and NAE (the target name we are searchng for.) Output: the telephone number for whch NAE = N, or f no such name exsts, prnt a message to the user. 9
6 Sequental Search.) Get n, N, K, N n,, K, n, NAE from the user.).) found false 4.) whle n and not found 5.) f N = NAE 6.) found true 7.) prnt 8.) else 9.) + 0.) f not found.) prnt sorry NAE not n drectory.) stop he varable found s called a logcal varable or Boolean varable (named after the Logcan George Boole). It stores one of the two logcal values true or false. A logcal expresson s an expresson whch evaluates to one of these two values. In order to understand how these expressons are evaluated, we must frst defne the logcal operators and, or, and not. A proposton s a statement or asserton whch can (at least n prncple) be evaluated as beng ether true or false. For nstance today s Wednesday and 6< 7 are propostons, whle hello and x < 7 are not propostons. Let A and B be propostonal varables,.e. varables whch stand for unspecfed propostons. We can form the compound propostons A and B, A or B, and not A, usng the operators and, or, and not, whch are defned as follows. A B A and B F F F F F F F In ths truth table, stands for true and F stands for false. In words, A and B s true only n the case when both operands are true, and s false n every other case. A B A or B F F F F F Agan n words, A or B s false only n the case when both operands are false, and s true n every other case. A not A F F hus not A just reverses the logcal value of ts operand A. he operators and and not have the same meanngs that any speaker of Englsh would expect. However there s some ambguty 0
7 n the Englsh language concernng the word or. he above truth table for or defnes an operaton whch s more properly called nclusve or. It asserts that ether A, or B, or possbly both are true here s another meanng of the word or n the Englsh language called exclusve or, abbrevated exor. hs operaton s defned by the followng truth table. A B A exor B F F F F F F hus A exor B asserts that ether A, or B, but not both are true. Unfortunately for speakers of Englsh, there s no such word as exor, and both meanngs are denoted by the word or. he lstner s expected to gather the meanng from the context. Example A man wth a gun walks up to you and says your money or your lfe. Whch or do you hope he s usng? Fortunately n athematcs and Computer Scence there s no ambguty. Whenever you see the word or used n a ath textbook, t means nclusve or. If we ever mean exclusve or, we explctly wrte exor (or perhaps some other symbol). Now we can see exactly how the logcal expressons on lnes 4 and 0 or Sequental Search wll be evaluated. here are many other examples of searchng problems where the data to be searched s n no partcular order. he algorthmc soluton s essentally the same as that of the phone book example,.e. step through the data from begnnng to end untl the target data tem s found. It s conceptually very useful and elegant to consder all these examples as beng dfferent nstances of the same problem, all solvable by the same algorthm. Snce everythng n Computer Scence s ultmately represent able by numbers, we can present ths Generalzed Sequental Search algorthm as a search of an unsorted lst of numbers for some target number. Input: n (the number of numbers n the lst), a,,an (the number to search for.) Output: he frst ndex such that Sequental Search.) Get n, a, K, an, target from the user.).) found false 4.) whle n and not found 5.) f a = target 6.) found true 7.) else 8.) + 9.) f not found 0.) 0.) prnt.) stop L (the lst of numbers tself), and target target = a, or 0 f no such ndex exsts.
8 Example race ths algorthm on the nput: n = 5, target =, and the lst, -,, 5,. Exercse odfy ths algorthm to fnd the last (.e. rghtmost) occurrence of the target. How can we modfy t to fnd the nd, or 5 th, or j th occurrence of the target? How can we modfy t to prnt the number of occurrences of the target? Another common problem n processng a lst of numbers s to fnd the largest or smallest number n the lst. he followng algorthm, called Fnd Largest, solves ths problem. Input: n (the number of numbers), and a, L,an (the lst of numbers, whch we assume to be dstnct). Output: he largest value n the lst, together wth the poston (.e. the ndex ) where t s located. Fnd Largest.) max a (max s the largest value seen so far).) j (j s the ndex of the largest value seen so far).) ( s the ndex of the element we are presently lookng at) 4.) whle n 5.) f a > max 6.) max a 7.) j 8.) + 9.) prnt max, j 0.) stop Example race ths algorthm on the lst,, -7, 5,,, 0. Exercse What happens f we run Fnd Largest on a lst whose elements are not dstnct? ry t on the lst,, 0, 0,, 5, 0. How can t be modfed to fnd all occurrences of the maxmum? How can t be modfed to fnd the mnmum? Exercse Assume that addton of ntegers s a prmtve operaton for the computng agent, but that multplcaton of ntegers s not. Wrte an algorthm whch takes as nput two (non-negatve) ntegers a and b, and prnts out ther product a b. Obvously one cannot wrte prnt a b snce we are assumng here that multplcaton s not prmtve. he problem s to defne multplcaton algorthmcally n terms of repeated addton, as follows..) get a, b.) product 0.) 4.) whle b 5.) product product+ a 6.) + 7.) prnt product 8.) stop
9 hs algorthm could be wrtten a lttle more succnctly usng a for loop..) get a, b.) product 0.) for to b 4.) product product+ a 5.) prnt product 8.) stop Exercse Now assume that multplcaton s a prmtve operaton for the computng agent, but that exponentaton (.e. rasng a number to a power) s not. Wrte an algorthm whch takes as b nput two (non-negatve) ntegers a and b, then prnts out the value a. Agan t s obvous that b statement prnt a s not a vald operaton. he problem s to defne exponentaton n terms of repeated multplcaton. A classcal problem n Computer Scence s Pattern atchng. here are many versons of ths problem dealng wth patterns n graphcs, sound, pctures, and other types of data. We wll consder a smple form of ths problem: fndng patterns n text data. ore precsely, gven n characters of text KKKKKKKKK n and gven a pattern of m characters, where m n P P P KK P m fnd every occurrence of the pattern wthn the text,.e. fnd each ndex poston n the text at whch the pattern begns. Example n = 8, m= text: to be or not to be pattern: be answer: 4, 7 Example n = 0, m= text: xxxaaaaaxx pattern: aaa answer: 4, 5, 6 Notce that f m =,.e. f the pattern has just one character n t, then ths problem s not essentally dfferent from the searchng problem. We may expect that our algorthm wll show some smlarty to Sequental Search. Our soluton wll be to smply compare the pattern, one character at tme, to m contguous text characters at every possble startng locaton wthn the text. We start by comparng P to, and f they match compare P to, and f they match compare P to, etc. We contnue n ths manner untl reach the end of the pattern and thus establsh that the pattern matches the text at poston, or untl we fnd two characters whch don t match, ndcatng a msmatch at poston. We then slde the pattern over one poston n
10 the text and compare P to, then P to, etc. as before untl we ether establsh a match or a msmatch at poston n the text. Every tme a match occurs, we prnt out the ndex wthn the text at whch the pattern and text matched. Example n = 7, m= check for match at poston = P P P slde over = P P P = P P P = P P P = P P P In ths case we see that the possble answers,.e. the set of possble ndces at whch a match can occur, are = to = 5, snce to slde the pattern over one more tme would cause t to fall off the end of the text. In general the ndces to be tested range from = to = n m+. Input: Integers n and m satsfyng m n, the text KKKn to be searched, and the pattern P P P KPm to search for. Output: All ndces such that P P P KPm matches + + K + m. Pattern atch.).) whle n m+.) j 4.) match true 5.) whle j m and match 6.) f P j + j 7.) match false 8.) else 9.) j j+ 0.) f match.) prnt match found at poston.) +.) stop 4
11 Exercse race ths algorthm on some smple examples lke to be or not to be or xxxaaaaaxx above. Search for varous patterns wthn these texts. Exercse How can ths algorthm be used to fnd words rather than patterns? For nstance consder the text hand the band to randy and I, and search for the pattern and. he answers wll be postons,, 8, and. However the word and appears only once, at poston. How can we use ths algorthm to fnd only the word and and not all occurrences of the pattern and wthn other words? 5
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 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 informationAgenda & 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 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 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 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 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 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 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 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 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 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 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 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 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 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 informationCE 221 Data Structures and Algorithms
CE 1 ata Structures and Algorthms Chapter 4: Trees BST Text: Read Wess, 4.3 Izmr Unversty of Economcs 1 The Search Tree AT Bnary Search Trees An mportant applcaton of bnary trees s n searchng. Let us assume
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 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 informationExercises (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 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 information6.854 Advanced Algorithms Petar Maymounkov Problem Set 11 (November 23, 2005) With: Benjamin Rossman, Oren Weimann, and Pouya Kheradpour
6.854 Advanced Algorthms Petar Maymounkov Problem Set 11 (November 23, 2005) Wth: Benjamn Rossman, Oren Wemann, and Pouya Kheradpour Problem 1. We reduce vertex cover to MAX-SAT wth weghts, such that the
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 informationModule 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 informationCSE 326: Data Structures Quicksort Comparison Sorting Bound
CSE 326: Data Structures Qucksort Comparson Sortng Bound Steve Setz Wnter 2009 Qucksort Qucksort uses a dvde and conquer strategy, but does not requre the O(N) extra space that MergeSort does. Here s the
More informationCSE 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 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 informationON 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 informationCHARUTAR 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 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 informationChapter 6 Programmng the fnte element method Inow turn to the man subject of ths book: The mplementaton of the fnte element algorthm n computer programs. In order to make my dscusson as straghtforward
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 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 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 informationMathematics 256 a course in differential equations for engineering students
Mathematcs 56 a course n dfferental equatons for engneerng students Chapter 5. More effcent methods of numercal soluton Euler s method s qute neffcent. Because the error s essentally proportonal to the
More informationCS 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 information5 The Primal-Dual Method
5 The Prmal-Dual Method Orgnally desgned as a method for solvng lnear programs, where t reduces weghted optmzaton problems to smpler combnatoral ones, the prmal-dual method (PDM) has receved much attenton
More informationOutline. 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 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 informationCS221: 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 informationR s s f. m y s. SPH3UW Unit 7.3 Spherical Concave Mirrors Page 1 of 12. Notes
SPH3UW Unt 7.3 Sphercal Concave Mrrors Page 1 of 1 Notes Physcs Tool box Concave Mrror If the reflectng surface takes place on the nner surface of the sphercal shape so that the centre of the mrror bulges
More informationIntro. 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 informationParallel Solutions of Indexed Recurrence Equations
Parallel Solutons of Indexed Recurrence Equatons Yos Ben-Asher Dep of Math and CS Hafa Unversty 905 Hafa, Israel yos@mathcshafaacl Gad Haber IBM Scence and Technology 905 Hafa, Israel haber@hafascvnetbmcom
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 informationSupport Vector Machines
/9/207 MIST.6060 Busness Intellgence and Data Mnng What are Support Vector Machnes? Support Vector Machnes Support Vector Machnes (SVMs) are supervsed learnng technques that analyze data and recognze patterns.
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 informationRange images. Range image registration. Examples of sampling patterns. Range images and range surfaces
Range mages For many structured lght scanners, the range data forms a hghly regular pattern known as a range mage. he samplng pattern s determned by the specfc scanner. Range mage regstraton 1 Examples
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 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 informationRelated-Mode Attacks on CTR Encryption Mode
Internatonal Journal of Network Securty, Vol.4, No.3, PP.282 287, May 2007 282 Related-Mode Attacks on CTR Encrypton Mode Dayn Wang, Dongda Ln, and Wenlng Wu (Correspondng author: Dayn Wang) Key Laboratory
More informationInsertion 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 informationOutline. 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 information3D 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 informationTN348: Openlab Module - Colocalization
TN348: Openlab Module - Colocalzaton Topc The Colocalzaton module provdes the faclty to vsualze and quantfy colocalzaton between pars of mages. The Colocalzaton wndow contans a prevew of the two mages
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 informationCompiling Process Networks to Interaction Nets
Complng Process Networks to Interacton Nets Ian Macke LIX, CNRS UMR 7161, École Polytechnque, 91128 Palaseau Cede, France Kahn process networks are a model of computaton based on a collecton of sequental,
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 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 informationHermite Splines in Lie Groups as Products of Geodesics
Hermte Splnes n Le Groups as Products of Geodescs Ethan Eade Updated May 28, 2017 1 Introducton 1.1 Goal Ths document defnes a curve n the Le group G parametrzed by tme and by structural parameters n the
More informationA SYSTOLIC APPROACH TO LOOP PARTITIONING AND MAPPING INTO FIXED SIZE DISTRIBUTED MEMORY ARCHITECTURES
A SYSOLIC APPROACH O LOOP PARIIONING AND MAPPING INO FIXED SIZE DISRIBUED MEMORY ARCHIECURES Ioanns Drosts, Nektaros Kozrs, George Papakonstantnou and Panayots sanakas Natonal echncal Unversty of Athens
More informationSubspace clustering. Clustering. Fundamental to all clustering techniques is the choice of distance measure between data points;
Subspace clusterng Clusterng Fundamental to all clusterng technques s the choce of dstance measure between data ponts; D q ( ) ( ) 2 x x = x x, j k = 1 k jk Squared Eucldean dstance Assumpton: All features
More informationConcurrent 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 informationToday 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 informationNAG Fortran Library Chapter Introduction. G10 Smoothing in Statistics
Introducton G10 NAG Fortran Lbrary Chapter Introducton G10 Smoothng n Statstcs Contents 1 Scope of the Chapter... 2 2 Background to the Problems... 2 2.1 Smoothng Methods... 2 2.2 Smoothng Splnes and Regresson
More informationA 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 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 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 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 informationSorting. Sorting. Why Sort? Consistent Ordering
Sortng CSE 6 Data Structures Unt 15 Readng: Sectons.1-. Bubble and Insert sort,.5 Heap sort, Secton..6 Radx sort, Secton.6 Mergesort, Secton. Qucksort, Secton.8 Lower bound Sortng Input an array A of data
More informationGSLM 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 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 informationPriority 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 informationSearching & Sorting. Definitions of Search and Sort. Linear Search in C++ Linear Search. Week 11. index to the item, or -1 if not found.
Searchng & Sortng Wee 11 Gadds: 8, 19.6,19.8 CS 5301 Sprng 2014 Jll Seaman 1 Defntons of Search and Sort Search: fnd a gven tem n a lst, return the ndex to the tem, or -1 f not found. Sort: rearrange the
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 informationF Geometric Mean Graphs
Avalable at http://pvamu.edu/aam Appl. Appl. Math. ISSN: 1932-9466 Vol. 10, Issue 2 (December 2015), pp. 937-952 Applcatons and Appled Mathematcs: An Internatonal Journal (AAM) F Geometrc Mean Graphs A.
More informationCHAPTER 2 DECOMPOSITION OF GRAPHS
CHAPTER DECOMPOSITION OF GRAPHS. INTRODUCTION A graph H s called a Supersubdvson of a graph G f H s obtaned from G by replacng every edge uv of G by a bpartte graph,m (m may vary for each edge by dentfyng
More informationAMath 483/583 Lecture 21 May 13, Notes: Notes: Jacobi iteration. Notes: Jacobi with OpenMP coarse grain
AMath 483/583 Lecture 21 May 13, 2011 Today: OpenMP and MPI versons of Jacob teraton Gauss-Sedel and SOR teratve methods Next week: More MPI Debuggng and totalvew GPU computng Read: Class notes and references
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 informationMath Homotopy Theory Additional notes
Math 527 - Homotopy Theory Addtonal notes Martn Frankland February 4, 2013 The category Top s not Cartesan closed. problem. In these notes, we explan how to remedy that 1 Compactly generated spaces Ths
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 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 informationNon-Split Restrained Dominating Set of an Interval Graph Using an Algorithm
Internatonal Journal of Advancements n Research & Technology, Volume, Issue, July- ISS - on-splt Restraned Domnatng Set of an Interval Graph Usng an Algorthm ABSTRACT Dr.A.Sudhakaraah *, E. Gnana Deepka,
More informationSome 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 informationNUMERICAL 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 informationData Representation in Digital Design, a Single Conversion Equation and a Formal Languages Approach
Data Representaton n Dgtal Desgn, a Sngle Converson Equaton and a Formal Languages Approach Hassan Farhat Unversty of Nebraska at Omaha Abstract- In the study of data representaton n dgtal desgn and computer
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 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 informationLecture 3: Computer Arithmetic: Multiplication and Division
8-447 Lecture 3: Computer Arthmetc: Multplcaton and Dvson James C. Hoe Dept of ECE, CMU January 26, 29 S 9 L3- Announcements: Handout survey due Lab partner?? Read P&H Ch 3 Read IEEE 754-985 Handouts:
More informationProblem Definitions and Evaluation Criteria for Computational Expensive Optimization
Problem efntons and Evaluaton Crtera for Computatonal Expensve Optmzaton B. Lu 1, Q. Chen and Q. Zhang 3, J. J. Lang 4, P. N. Suganthan, B. Y. Qu 6 1 epartment of Computng, Glyndwr Unversty, UK Faclty
More informationAlgorithm To Convert A Decimal To A Fraction
Algorthm To Convert A ecmal To A Fracton by John Kennedy Mathematcs epartment Santa Monca College 1900 Pco Blvd. Santa Monca, CA 90405 jrkennedy6@gmal.com Except for ths comment explanng that t s blank
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 informationIntroduction. Leslie Lamports Time, Clocks & the Ordering of Events in a Distributed System. Overview. Introduction Concepts: Time
Lesle Laports e, locks & the Orderng of Events n a Dstrbuted Syste Joseph Sprng Departent of oputer Scence Dstrbuted Systes and Securty Overvew Introducton he artal Orderng Logcal locks Orderng the Events
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 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 informationTransaction-Consistent Global Checkpoints in a Distributed Database System
Proceedngs of the World Congress on Engneerng 2008 Vol I Transacton-Consstent Global Checkponts n a Dstrbuted Database System Jang Wu, D. Manvannan and Bhavan Thurasngham Abstract Checkpontng and rollback
More informationDesign 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 informationSENSITIVITY 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 informationPolyhedral 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 informationMachine Learning. Topic 6: Clustering
Machne Learnng Topc 6: lusterng lusterng Groupng data nto (hopefully useful) sets. Thngs on the left Thngs on the rght Applcatons of lusterng Hypothess Generaton lusters mght suggest natural groups. Hypothess
More information