4 Sorting Atomic Items
|
|
- Philippa Leonard
- 5 years ago
- Views:
Transcription
1 4 Sortig Atomic Items 4.1 The merge-based sortig paradigm A lower boud o I/Os The distributio-based sortig paradigm Partitioig Pivot Selectio Limitig the umber of recursio levels The qsort stadard algorithm Sample Sort 4.4 Sortig with multi-disks A geeral techique: disk stripig Sortig o multi-disks This lecture will focus o the very-well kow problem of sortig a set of atomic items, the case of variable-legth items (aka strigs) will be addressed i the followig chapter. Atomic meas that they occupy O(1) space, typically they are itegers or reals represeted with a fixed umber of bytes, such as 4 (32 bits) or 8 (64 bits) bytes each. The sortig problem. Give a sequece of atomic items S [1, ] ad a total orderig betwee each of them, sort S i icreasig order. We will cosider two complemetal sortig paradigms: the merge-based paradigm, which uderlies the desig of Mergesort, ad the distributio-based paradigm which uderlies the desig of Quicksort. We will adapt them to work i the disk model (see Chapter 1), aalyze their I/O-complexities ad propose some useful tools that ca allow to speed up their executio i practice, such as the Sow Plow techique ad Data compressio. We will also demostrate that these disk-based adaptatios are I/O-optimal by provig a sophisticated lower-boud o the umber of I/Os ay exteralmemory sorter must execute to produce a ordered sequece. I this cotext we will relate the Sortig problem with the so called Permutig problem, typically eglected whe dealig with sortig i the RAM model. The permutig problem. Give a sequece of atomic items S [1, ] ad a permutatioπ[1, ] of the itegers{1, 2,...,}, permute S accordig toπthus obtaiig the ew sequece S [π[1]], S [π[2]],...,s[π[]]. Clearly Sortig icludes Permutig as a sub-task: to order the sequece S we eed to determie its sorted permutatio ad implemet it (possibly these two phases are itricately itermigled). So Sortig should be more difficult tha Permutig. Ad ideed i the RAM model we kow that sortig atomic items takes Θ( log ) time (via Mergesort or Heapsort) whereas permutig them takesθ() time. The latter time boud ca be obtaied by just movig oe item at a time accordig to what is idicated i the arrayπ. But surprisigly we will show that this complexity gap does ot exist i the disk model, i that they exhibit the same I/O-complexity uder some reasoable c Paolo Ferragia 4-1
2 4-2 Paolo Ferragia coditios o the iput ad model parameters, M, B. This elegat ad deep result was obtaied by Aggarwal ad Vitter i 1998 [1], ad it is surely the result that spurred the huge amout of algorithmic literature thereafter produced o the I/O-subject. Philosophically speakig, AV s result formally proves the ituitio that movig items i the disk is the real efficiecy bottleeck, rather tha the uderlyig computatio eeded to determie those movemets. Ad ideed researchers ad software egieers typically speak about the I/O-bottleeck to characterize this issue i their (slow) algorithms. We will coclude this lecture by briefly metioig at two solutios for the problem of sortig items o D-disks: the disk-stripig techique, which is at the base of RAID systems ad turs ay efficiet/optimal 1-disk algorithm ito a efficiet D-disk algorithm (typically loosig its optimality, if ay), ad the Greed-sort algorithm, which is specifically tailored for the sortig problem ad achieves I/O-optimality. 4.1 The merge-based sortig paradigm We recall the mai features of the exteral-memory model itroduced i Chapter 1: it cosists of a iteral memory of size M ad it allows blocked-access to disk data by readig/writig B items at oce. Algorithm 4.1 The biary merge-sort: MergeSort(S, i, j) 1: if (i< j) the 2: m=(i+ j)/2; 3: MergeSort(S, i, m 1); 4: MergeSort(S, m, j); 5: Merge(S, i, m, j); 6: ed if Mergesort is based o the Divide&Coquer paradigm. Step 1 checks if the array to be sorted cosists of at least two items, otherwise it is already ordered ad othig has to be doe. Otherwise it splits the iput array S ito two halves, accordig to the positio m of the middle elemet, ad the recurse o each part. As recursio eds, the two halves S [i, m 1] ad S [m, j] are sorted so that Step 5 ivokes procedure Merge that fuses their cotets ad produce a uique sorted sequece that is stored i S [i, j]. This mergig eeds a auxiliary array of size, so that MergeSort is ot a i-place sortig algorithm (ulike Heapsort ad Quicksort) but eeds O() extra workig space. Give that at each recursive call we halve the size of the iput array to be sorted, the total umber of recursive calls is O(log ). The Merge-procedure ca be implemeted i O( j i+1) time by usig two poiters, say x ad y, that start at the begiig of the two halves S [i, m 1] ad S [m, j]. The S [x] is compared with S [y], the smaller is writte out i the fused sequece, ad its poiter is advaced. Give that each compariso advace oe poiter, the total umber of steps is bouded above by the total umber of poiter s advacemets, which is upper bouded by the legth of S [i, j]. So the time complexity of MergeSort(S, 1, ) ca be modeled via the recurret relatio T()=2T(/2)+O()=O( log ), as well kow from ay basic algorithm course. 1 Let us assume ow that > M, so that S must be stored o disk ad I/Os because the most im- 1 I all our lectures whe the base of the logarithm is ot idicated, it meas 2.
3 Sortig Atomic Items 4-3 portat resource to be aalyzed. I practice every I/O takes 5ms o average, so oe could thik that every item compariso takes oe I/O ad thus estimate the ruig time of Mergesort o massive data as: 5ms Θ( log ). If is of the order of few Gigabytes, say which is actually ot much massive for the curret-size of commodity PCs, the previous time estimate would be of about >10 8 ms, amely more tha 1 day of computatio. However, if we ru Mergesort o a commodity PC it completes i few hours. This is ot surprisig because the previous evaluatio totally eglected the existece of the iteral memory, of size M, ad the sequetial patter of memory-accesses iduced by Mergesort. Let us therefore aalyze the Mergesort algorithm i a more precise way withi the disk model. First of all we otice that O(z/B) I/Os is the cost of mergig two ordered sequeces of z items i total. This holds if M 2B, because the Merge-procedure i Algorithm?? ca keep i iteral memory the 2 pages that cotai the two poiters scaig S [i, j]. Every time a poiter advaces ito aother disk page, a I/O-fault occurs, the page is fetched i iteral memory, ad the fusio cotiues. Give that S is stored cotiguously o disk, it occupies O(z/B) pages ad this is the I/O-boud for mergig two sub-sequeces of total size z. Similarly, the I/O-cost for writig the merged sequece is O(z/B) because it occurs sequetially from the smallest to the largest item of S [i, j]. As a result the recurret relatio for the I/O-complexity of Mergesort ca be writte as T() = 2T(/2)+O(/B) = O( B log ) I/Os. But this formula does ot explai completely the good behavior of Mergesort i practice, because it does ot accout for the memory hierarchy yet. I fact as Mergesort recursively splits the sequece S, smaller ad smaller sub-sequeces are geerated that have to be sorted. So whe a subsequece of legthlfits i iteral memory, amelyl=θ(m), the it will be etirely cached by the uderlyig operatig system usig O(l/B) I/Os ad thus, the subsequet sortig steps would ot icur i ay I/Os. The et result of this simple observatio is that the I/O-cost of sortig a sub-sequece ofl=o(m) items is o loger T(l)=Θ( l B logl) but O(l/B). This savig applies to all S s subsequeces of sizeθ(m) o which Mergesort is recursively ru, which areθ(/m) i total. So the overall savig isθ( B log M), which leads us to re-formulate the Mergesort s complexity asθ( B log M ) I/Os. This boud is particularly iterestig because relates the I/O-complexity of Mergesort ot oly to the disk-page size B but also to the iteral-memory size M, ad thus to the cachig available for the computatio. Moreover this bouds suggests three immediate optimizatios to the classic pseudocode of Algorithm 4.3 the we discuss below. Optimizatio #1: Takig care of iteral-memory size. The first optimizatio cosists of itroducig a threshold o the subsequece size, say j i<cm, which triggers the stop of the recursio, the fetchig of that subsequece etirely i iteral-memory, ad the applicatio of a iteralmemory sorter o this sub-sequece (see Figure 4.1). The value of the parameter c depeds o the space-occupacy of the sorter, which must be guarateed to work etirely i iteral memory. As a example, c is 1 for i-place sorters such as Isertiosort ad Heapsort, it is much close to 1 for Quicksort (because of its recursio), ad it is less tha 0.5 for Mergesort (because of the extra-array used by Merge). As a result, we should write cm istead of M ito the I/O-boud above, because recursio is stopped at cm items: thus obtaiigθ( B log cm ). This substitutio is useless whe dealig with asymptotic aalysis, give that c is a costat, but it is importat whe cosiderig the real performace of algorithms. I this settig it is desirable to make c as closer as possible to 1, i order to reduce the logarithmic factor i the I/O-complexity thus preferrig i-place sorters such as Heapsort or Quicksort. We remark that Isertiosort could also be a good choice (ad ideed it is) wheever M is small, as it occurs whe cosiderig the sortig of items over the 2-levels: L1 ad L2 caches, ad the iteral memory. I this case M would be few Megabytes. Optimizatio #2: Virtually elargig M. Lookig at the I/O-complexity of mergesort, i.e.θ( B log M ), is clear that the larger is M the smaller is the umber of merge-passes over the data. These are clearly the bottleeck to the efficiet executio of the algorithm especially i the presece of disks with low
4 4-4 Paolo Ferragia badwidth. I order to circumvet this problem we ca either buy a larger memory, or try to deploy as much as possible the oe we have available. As algorithm egieer we opt for the secod possibility ad thus propose two techiques that ca be combied together i order to elarge (virtually) M. The first techique is based o data compressio ad builds upo the observatio that the rus are icreasigly sorted. So, istead of represetig items via a fixed-legth codig (e.g. 4 or 8 bytes), we ca use iteger compressio techiques that squeeze those items i fewer bits thus allowig us to pack more of them i iteral memory. A followig lecture will describe i detail several approaches to this problem (see Chapter??), here we cotet ourselves metioig the ames of some of these approaches: γ-code, δ-code, Rice/Golomb-codig, etc. etc.. I additio, sice the smaller is a iteger the fewer bits are used for its ecodig, we ca eforce the presece of small itegers i the sorted rus by ecodig ot just their absolute value but the differece betwee oe iteger ad the previous oe i the sorted ru (the so called delta-codig). This differece is surely o egative (equals zero if the ru cotais equal items), ad smaller tha the item to be ecoded. This is the typical approach to the ecodig of iteger sequeces used i moder search egies, that we will discuss i a followig lecture (see Chapter??). FIGURE 4.1: Whe a ru fits i the iteral memory of size M, we applyqsort over its items. I gray we depict the recursive calls that are executed i iteral memory, ad thus do ot elicit I/Os. Above there are the calls based o classic Mergesort, oly the call o 2M items is show. The secod techique is based o a elegat idea, called thesow Plow ad due to D. Kuth [2], that allows to virtually icrease the memory size of a factor 2 o average. This techique scas the iput sequece S ad geerates sorted rus of whose legth has variable size loger tha M ad 2M o average. Its use eeds to chage the sortig scheme because it first creates these sorted rus, of variable legth, ad the applies repeatedly over the sorted rus the Merge-procedure. Although rus will have differet legths, the Merge will operate as usual requirig a optimal umber of I/Os for their mergig. Hece O(/B) I/Os will suffice to halve the umber of rus, ad thus a total of O( B log 2M ) I/Os will be used o average to produce the totally ordered sequece. This correspods to a savig of 1 pass over the data, which is o egligible if the sequece S is very log. For ease of descriptio, let us assume that items are trasferred oe at a time from disk to memory, istead that block-wise. Evetually, sice the algorithm scas the iput items it will be apparet that the umber of I/Os required by this process is liear i their umber (ad thus optimal). The algorithm proceeds i phases, each phase geerates a sorted ru (see Figure 4.2 for a illustrative example). A phase starts with the iteral-memory filled of M (usorted) items, stored i a heap data structure called H. Sice the array-based implemetatio of heaps requires o additioal space, i additio to the idexed items, we ca fit ih as may items as we have memory cells available.
5 Sortig Atomic Items 4-5 FIGURE 4.2: A illustratio of four steps of a phase i Sow Plow. The leftmost picture shows the startig step i whichu is heapified, the a picture shows the output of the miimum elemet i H, hece the two possible cases for the isertio of the ew item, ad fially the stoppig coditio i whichh is empty adu fills etirely the iteral memory. The phase scas the iput sequece S (which is usorted) ad at each step, it writes to the output the miimum item withih, saymi, ad loads i memory the ext item from S, sayext. Sice we wat to geerate a sorted output, we caot storeext ih ifext<mi, because it will be the ew heap-miimum ad thus will be writte out at the ext step thus destroyig the property of icreasig ru. So i that caseext must be stored i a auxiliary array, calledu, which stays usorted. Of course the total size ofh adu is M over the whole executio of a phase. A phase stops wheeverh is empty ad thusu cosists of M usorted items, ad the ext phase ca thus start (storig those items i a ew heaph ad emptyigu). Two observatios are i order: (i) durig the phase executio, the miimum ofh is o decreasig ad so it is the output, (ii) the items ih at the begiig of the phase will be evetually writte to output which thus is loger tha M. Observatio (i) implies the correctess, observatio (ii) implies that this approach is ot less efficiet tha the classic Mergesort. Algorithm 4.2 A phase of the Sow-Plow techique Require: U is a usorted array of M items 1: H= build a mi-heap overu s items; 2: SetU= ; 3: while (H ) do 4: mi=extract miimum fromh; 5: Writemi to the output ru; 6: ext=read the ext item from the iput sequece; 7: if (ext < mi) the 8: writeext iu; 9: else 10: isertext ih; 11: ed if 12: ed while Actually it is more efficiet tha that o average. Suppose that a phase readsτitems i total from S. By the while-guard i Step 3 ad our commets above, we ca derive that a phase eds wheh is empty ad U = M. We kow that the read items go i part ih ad i part iu. But sice items are added tou ad ever removed durig a phase, M of theτitems ed-up iu. Cosequetly (τ M) items are iserted ih ad evetually writte to the output (sorted) ru. So the legth of the sorted ru at the ed of the phase is M+ (τ M), where the first addedum accouts for the items ih at the begiig of a phase, whereas the secod addedum accouts for the items read
6 4-6 Paolo Ferragia from S ad iserted ih durig the phase. The key issue ow is to compute the average ofτ. This is easy if we assume a radom distributio of the iput items. I this case we have probability 1/2 thatext is smaller thami, ad thus we have equal probability that a read item is iserted either ih or iu. Overall it follows thatτ/2 items go toh adτ/2 items go tou. But we already kew that the items iserted iu were M, so we ca set M=τ/2 ad thusτ=2m. Substitutig i the formula M+ (τ M) we get that the average umber of items writte i the sorted ru is 2M. FACT 4.1 Sow-Plow builds O(/M) sorted rus, each loger tha M ad actually of legth 2M o average. Usig Sow-Plow for the formatio of sorted rus i a Merge-based sortig scheme achieves a I/O-complexity of O( B log 2 2M ). Optimizatio #3: From biary to multi-way Mergesort. Previous optimizatios deployed the iteral-memory size M to reduce the umber of recursio levels by icreasig the size of the iitial (sorted) rus. But the the mergig was biary i that it fused two iput rus at a time. This biarymerge impacted oto the base 2 of the logarithm of the I/O-complexity of Mergesort. Here we wish to icrease that base to a much larger value, ad i order to get this goal we eed to deploy the memory M also i the mergig phase by elargig the umber of rus that are fused at a time. I fact the merge of 2 rus uses oly 3 blocks of the iteral memory: 2 blocks are used to cache the curret disk pages that cotai the compared items, amely S [x] ad S [y] from the otatio above, ad 1 block is used to cache the output items which are flushed whe the block is full (so to allow a blockwise writig to disk of the merged ru). But the iteral memory cotais a much larger umber of blocks, i.e. M/B 3, which remai uused over the whole mergig process. The third optimizatio we propose cosists of deployig all those blocks by desigig a k-way mergig scheme that fuses k rus at a time, with k 2. Let us set k=(m/b) 1, so that k blocks are available to read block-wise k iput rus, ad 1 block is reserved agai for a block-wise writig of the merged ru to disk. This scheme poses a challegig mergig problem because at each step we have to select the miimum amog k cadidates items ad this caot be obviously doe brute-forcedly by iteratig amog them. We eed a smarter solutio that agai higes oto the use of a mi-heap data structure, which cotais k pairs (oe per iput ru) each cosistig of two compoets: oe deotig a item ad the other deotig the origi ru. Iitially the items are the miimum items of the k rus, ad so the pairs have the form R i [1], i, where R i deotes the ith iput ru ad i=1, 2,...,k. At each step, we extract the pair cotaiig the curret smallest item ih (give by the first compoet of its pairs), write that item to output ad isert i the heap the ext item i its origi ru. As a example, if the miimum pair is R m [x], m the we write i output R m [x] ad isert ih the ew pair R m [x+1], m, provided that the mth ru is ot exhausted, i which case o pair replaces the extracted oe. I the case that the disk page cotaiig R m [x+1] is ot cached i iteral memory, a I/O-fault occurs ad that page is fetched, thus guarateeig that the ext B reads from ru R m will ot elicit ay further I/O. It should be clear that this mergig process takes O(log 2 k) time per item, ad agai O(z/B) I/Os to merge k rus of total legth z. As a result the mergigscheme recalls a k-way tree with O(/M) leaves (rus) which ca have bee formed usig ay of the optimizatios above (possibly via Sow Plow). Hece the total umber of mergig levels is ow O(log M/B M ) for a total volume of I/Os equal to O( B log M/B M ). We observe that sometime we will also write the formula as O( B log M/B M ), as it typically occurs i the literature, by exchagig the deomiator withi the logarithm s argumet. This makes o differece asymptotically give that log M/B M =Θ(log M/B B ). THEOREM 4.1 Multi-way Mergesort takes O( B log M/B M ) I/Os ad O( log ) time to sort atomic items i a two-level model i which the iteral memory has size M ad the disk page has
7 Sortig Atomic Items 4-7 size B. The use of Sow-Plow or iteger compressors would virtually icrease the value of M with a twofold advatage i the fial I/O-complexity, because M occurs twice i the I/O-boud. I practice the umber of mergig levels will be very small: assumig a block size B=4KB ad a memory size M= 4GB, we get M/B=2 32 /2 12 = 2 20 so that the umber of passes is 1/20th smaller tha the oes eeded by biary Mergesort. Probably more iterestig is to observe that oe pass is able to sort = M items, but two passes are able to sort M 2 /B items, sice we ca merge M/B-rus each of size M. It goes without sayig that i practice the iteral-memory space which ca be dedicated to sortig is smaller tha the physical memory available (typically MBs versus GBs). Nevertheless it is evidet that M 2 /B is of the order of Terabytes already for M= 128MB ad B=4KB. 4.2 A lower boud o I/Os At the begiig of this lecture we commeted o the relatio existig betwee the Sortig ad the Permutig problems, cocludig that the former oe is more difficult tha the latter i the RAM model. The gap i time complexity is give by a logarithmic factor. The questio we address i this sectio is whether this gap does exist also whe measurig I/Os. Surprisigly eough we will show that i terms of I/O-volume Sortig is equivalet to Permutig. This result is amazig because it ca be read as sayig that the I/O-cost for sortig is ot i the computatio of the sorted permutatio but rather the movemet of the data o the disk to realize it. This is the so called I/O-bottleeck that has i this result the mathematical proof ad quatificatio. Before diggig ito the proof of this lower boud, let us briefly show how a sorter ca be used to permute a sequece of items S [1, ] i accordace to a give permutatioπ[1, ]. This will allow us to derive a upper boud to the umber of I/Os which suffice to solve the Permutig problem o ay S,π. Recall that this meas to geerate the sequece S [π[1]], S [π[2]],...,s[π[]]. I the RAM model we ca jump amog S s items accordig to permutatioπad create the ew sequece S [π[i]] takig O() optimal time. O disk we have actually two differet algorithms which iduce two icomparable I/O-bouds. The first algorithm cosists of mimickig what is doe i RAM, payig oe I/O per moved item ad thus takig O() I/Os. The secod algorithm cosists of geeratig a proper set of tuples ad the sort them. Precisely, the algorithm creates the sequecepof pairs i,π[i] where the first compoet idicates the positio i where the item S [π[i]] must be stored. The it sorts these pairs accordig to theπ-compoet, ad via a parallel sca of S adpsubstitutesπ[i] with the character S [π[i]], thus creatig the ew pairs i, S [π[i]]. Fially aother sort is executed accordig to the first compoet of these pairs, thus obtaiig a sequece of items correctly permuted. The algorithm uses two sca of the data ad two sorts, so it eeds O( B log M/B M ) I/Os. THEOREM 4.2 Permutig items takes O(mi{, B log M/B /M}) I/Os i a two-level model i which the iteral memory has size M ad the disk page has size B. I what follows we will show that this algorithm, i its simplicity, is I/O-optimal. The two upperbouds for Sortig ad Permutig equal each other wheever =Ω( B log M/B M ). This occurs whe B>log M/B M that holds always i practice because that logarithm term is about 2 or 3 for values of up to may Terabytes. So programmers should ot be afraid to fid sophisticated strategies for movig their data i the presece of a permutatio, just sort them, you caot do better! A lower-boud for Sortig. There are some subtle issues here that we wish to do ot ivestigate too much, so we hereafter give oly the ituitio which uderlies the lower-bouds for both Sortig
5 Sorting Atomic Items
5 Sortig Atomic Items 5.1 The merge-based sortig paradigm... 5-2 Stoppig recursio Sow Plow From biary to multi-way Mergesort 5.2 Lower bouds... 5-7 A lower-boud for Sortig A lower-boud for Permutig 5.3
More informationLecture 5. Counting Sort / Radix Sort
Lecture 5. Coutig Sort / Radix Sort T. H. Corme, C. E. Leiserso ad R. L. Rivest Itroductio to Algorithms, 3rd Editio, MIT Press, 2009 Sugkyukwa Uiversity Hyuseug Choo choo@skku.edu Copyright 2000-2018
More informationData Structures and Algorithms Part 1.4
1 Data Structures ad Algorithms Part 1.4 Werer Nutt 2 DSA, Part 1: Itroductio, syllabus, orgaisatio Algorithms Recursio (priciple, trace, factorial, Fiboacci) Sortig (bubble, isertio, selectio) 3 Sortig
More informationData Structures Week #9. Sorting
Data Structures Week #9 Sortig Outlie Motivatio Types of Sortig Elemetary (O( 2 )) Sortig Techiques Other (O(*log())) Sortig Techiques 21.Aralık.2010 Boraha Tümer, Ph.D. 2 Sortig 21.Aralık.2010 Boraha
More informationLecture Notes 6 Introduction to algorithm analysis CSS 501 Data Structures and Object-Oriented Programming
Lecture Notes 6 Itroductio to algorithm aalysis CSS 501 Data Structures ad Object-Orieted Programmig Readig for this lecture: Carrao, Chapter 10 To be covered i this lecture: Itroductio to algorithm aalysis
More informationCIS 121 Data Structures and Algorithms with Java Spring Stacks, Queues, and Heaps Monday, February 18 / Tuesday, February 19
CIS Data Structures ad Algorithms with Java Sprig 09 Stacks, Queues, ad Heaps Moday, February 8 / Tuesday, February 9 Stacks ad Queues Recall the stack ad queue ADTs (abstract data types from lecture.
More informationSorting in Linear Time. Data Structures and Algorithms Andrei Bulatov
Sortig i Liear Time Data Structures ad Algorithms Adrei Bulatov Algorithms Sortig i Liear Time 7-2 Compariso Sorts The oly test that all the algorithms we have cosidered so far is compariso The oly iformatio
More informationCSE 417: Algorithms and Computational Complexity
Time CSE 47: Algorithms ad Computatioal Readig assigmet Read Chapter of The ALGORITHM Desig Maual Aalysis & Sortig Autum 00 Paul Beame aalysis Problem size Worst-case complexity: max # steps algorithm
More information6.854J / J Advanced Algorithms Fall 2008
MIT OpeCourseWare http://ocw.mit.edu 6.854J / 18.415J Advaced Algorithms Fall 2008 For iformatio about citig these materials or our Terms of Use, visit: http://ocw.mit.edu/terms. 18.415/6.854 Advaced Algorithms
More informationLower Bounds for Sorting
Liear Sortig Topics Covered: Lower Bouds for Sortig Coutig Sort Radix Sort Bucket Sort Lower Bouds for Sortig Compariso vs. o-compariso sortig Decisio tree model Worst case lower boud Compariso Sortig
More informationCIS 121 Data Structures and Algorithms with Java Spring Stacks and Queues Monday, February 12 / Tuesday, February 13
CIS Data Structures ad Algorithms with Java Sprig 08 Stacks ad Queues Moday, February / Tuesday, February Learig Goals Durig this lab, you will: Review stacks ad queues. Lear amortized ruig time aalysis
More informationAnalysis Metrics. Intro to Algorithm Analysis. Slides. 12. Alg Analysis. 12. Alg Analysis
Itro to Algorithm Aalysis Aalysis Metrics Slides. Table of Cotets. Aalysis Metrics 3. Exact Aalysis Rules 4. Simple Summatio 5. Summatio Formulas 6. Order of Magitude 7. Big-O otatio 8. Big-O Theorems
More informationThe isoperimetric problem on the hypercube
The isoperimetric problem o the hypercube Prepared by: Steve Butler November 2, 2005 1 The isoperimetric problem We will cosider the -dimesioal hypercube Q Recall that the hypercube Q is a graph whose
More informationHeaps. Presentation for use with the textbook Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 2015
Presetatio for use with the textbook Algorithm Desig ad Applicatios, by M. T. Goodrich ad R. Tamassia, Wiley, 201 Heaps 201 Goodrich ad Tamassia xkcd. http://xkcd.com/83/. Tree. Used with permissio uder
More informationChapter 24. Sorting. Objectives. 1. To study and analyze time efficiency of various sorting algorithms
Chapter 4 Sortig 1 Objectives 1. o study ad aalyze time efficiecy of various sortig algorithms 4. 4.7.. o desig, implemet, ad aalyze bubble sort 4.. 3. o desig, implemet, ad aalyze merge sort 4.3. 4. o
More informationCSE 2320 Notes 8: Sorting. (Last updated 10/3/18 7:16 PM) Idea: Take an unsorted (sub)array and partition into two subarrays such that.
CSE Notes 8: Sortig (Last updated //8 7:6 PM) CLRS 7.-7., 9., 8.-8. 8.A. QUICKSORT Cocepts Idea: Take a usorted (sub)array ad partitio ito two subarrays such that p q r x y z x y y z Pivot Customarily,
More informationCIS 121 Data Structures and Algorithms with Java Fall Big-Oh Notation Tuesday, September 5 (Make-up Friday, September 8)
CIS 11 Data Structures ad Algorithms with Java Fall 017 Big-Oh Notatio Tuesday, September 5 (Make-up Friday, September 8) Learig Goals Review Big-Oh ad lear big/small omega/theta otatios Practice solvig
More informationHow do we evaluate algorithms?
F2 Readig referece: chapter 2 + slides Algorithm complexity Big O ad big Ω To calculate ruig time Aalysis of recursive Algorithms Next time: Litterature: slides mostly The first Algorithm desig methods:
More informationPseudocode ( 1.1) Analysis of Algorithms. Primitive Operations. Pseudocode Details. Running Time ( 1.1) Estimating performance
Aalysis of Algorithms Iput Algorithm Output A algorithm is a step-by-step procedure for solvig a problem i a fiite amout of time. Pseudocode ( 1.1) High-level descriptio of a algorithm More structured
More informationSorting 9/15/2009. Sorting Problem. Insertion Sort: Soundness. Insertion Sort. Insertion Sort: Running Time. Insertion Sort: Soundness
9/5/009 Algorithms Sortig 3- Sortig Sortig Problem The Sortig Problem Istace: A sequece of umbers Objective: A permutatio (reorderig) such that a ' K a' a, K,a a ', K, a' of the iput sequece The umbers
More informationMorgan Kaufmann Publishers 26 February, COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface. Chapter 5
Morga Kaufma Publishers 26 February, 28 COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Iterface 5 th Editio Chapter 5 Set-Associative Cache Architecture Performace Summary Whe CPU performace icreases:
More informationCS200: Hash Tables. Prichard Ch CS200 - Hash Tables 1
CS200: Hash Tables Prichard Ch. 13.2 CS200 - Hash Tables 1 Table Implemetatios: average cases Search Add Remove Sorted array-based Usorted array-based Balaced Search Trees O(log ) O() O() O() O(1) O()
More informationExamples and Applications of Binary Search
Toy Gog ITEE Uiersity of Queeslad I the secod lecture last week we studied the biary search algorithm that soles the problem of determiig if a particular alue appears i a sorted list of iteger or ot. We
More informationFast Fourier Transform (FFT) Algorithms
Fast Fourier Trasform FFT Algorithms Relatio to the z-trasform elsewhere, ozero, z x z X x [ ] 2 ~ elsewhere,, ~ e j x X x x π j e z z X X π 2 ~ The DFS X represets evely spaced samples of the z- trasform
More informationcondition w i B i S maximum u i
ecture 10 Dyamic Programmig 10.1 Kapsack Problem November 1, 2004 ecturer: Kamal Jai Notes: Tobias Holgers We are give a set of items U = {a 1, a 2,..., a }. Each item has a weight w i Z + ad a utility
More information1 Graph Sparsfication
CME 305: Discrete Mathematics ad Algorithms 1 Graph Sparsficatio I this sectio we discuss the approximatio of a graph G(V, E) by a sparse graph H(V, F ) o the same vertex set. I particular, we cosider
More informationwhy study sorting? Sorting is a classic subject in computer science. There are three reasons for studying sorting algorithms.
Chapter 5 Sortig IST311 - CIS65/506 Clevelad State Uiversity Prof. Victor Matos Adapted from: Itroductio to Java Programmig: Comprehesive Versio, Eighth Editio by Y. Daiel Liag why study sortig? Sortig
More informationn n B. How many subsets of C are there of cardinality n. We are selecting elements for such a
4. [10] Usig a combiatorial argumet, prove that for 1: = 0 = Let A ad B be disjoit sets of cardiality each ad C = A B. How may subsets of C are there of cardiality. We are selectig elemets for such a subset
More informationCSC 220: Computer Organization Unit 11 Basic Computer Organization and Design
College of Computer ad Iformatio Scieces Departmet of Computer Sciece CSC 220: Computer Orgaizatio Uit 11 Basic Computer Orgaizatio ad Desig 1 For the rest of the semester, we ll focus o computer architecture:
More informationHomework 1 Solutions MA 522 Fall 2017
Homework 1 Solutios MA 5 Fall 017 1. Cosider the searchig problem: Iput A sequece of umbers A = [a 1,..., a ] ad a value v. Output A idex i such that v = A[i] or the special value NIL if v does ot appear
More informationSolution printed. Do not start the test until instructed to do so! CS 2604 Data Structures Midterm Spring, Instructions:
CS 604 Data Structures Midterm Sprig, 00 VIRG INIA POLYTECHNIC INSTITUTE AND STATE U T PROSI M UNI VERSI TY Istructios: Prit your ame i the space provided below. This examiatio is closed book ad closed
More informationA New Morphological 3D Shape Decomposition: Grayscale Interframe Interpolation Method
A ew Morphological 3D Shape Decompositio: Grayscale Iterframe Iterpolatio Method D.. Vizireau Politehica Uiversity Bucharest, Romaia ae@comm.pub.ro R. M. Udrea Politehica Uiversity Bucharest, Romaia mihea@comm.pub.ro
More informationA Generalized Set Theoretic Approach for Time and Space Complexity Analysis of Algorithms and Functions
Proceedigs of the 10th WSEAS Iteratioal Coferece o APPLIED MATHEMATICS, Dallas, Texas, USA, November 1-3, 2006 316 A Geeralized Set Theoretic Approach for Time ad Space Complexity Aalysis of Algorithms
More informationThe Magma Database file formats
The Magma Database file formats Adrew Gaylard, Bret Pikey, ad Mart-Mari Breedt Johaesburg, South Africa 15th May 2006 1 Summary Magma is a ope-source object database created by Chris Muller, of Kasas City,
More informationLecturers: Sanjam Garg and Prasad Raghavendra Feb 21, Midterm 1 Solutions
U.C. Berkeley CS170 : Algorithms Midterm 1 Solutios Lecturers: Sajam Garg ad Prasad Raghavedra Feb 1, 017 Midterm 1 Solutios 1. (4 poits) For the directed graph below, fid all the strogly coected compoets
More informationRunning Time ( 3.1) Analysis of Algorithms. Experimental Studies. Limitations of Experiments
Ruig Time ( 3.1) Aalysis of Algorithms Iput Algorithm Output A algorithm is a step- by- step procedure for solvig a problem i a fiite amout of time. Most algorithms trasform iput objects ito output objects.
More informationAnalysis of Algorithms
Aalysis of Algorithms Iput Algorithm Output A algorithm is a step-by-step procedure for solvig a problem i a fiite amout of time. Ruig Time Most algorithms trasform iput objects ito output objects. The
More informationCopyright 2016 Ramez Elmasri and Shamkant B. Navathe
Copyright 2016 Ramez Elmasri ad Shamkat B. Navathe CHAPTER 18 Strategies for Query Processig Copyright 2016 Ramez Elmasri ad Shamkat B. Navathe Itroductio DBMS techiques to process a query Scaer idetifies
More information15-859E: Advanced Algorithms CMU, Spring 2015 Lecture #2: Randomized MST and MST Verification January 14, 2015
15-859E: Advaced Algorithms CMU, Sprig 2015 Lecture #2: Radomized MST ad MST Verificatio Jauary 14, 2015 Lecturer: Aupam Gupta Scribe: Yu Zhao 1 Prelimiaries I this lecture we are talkig about two cotets:
More informationGraphs. Minimum Spanning Trees. Slides by Rose Hoberman (CMU)
Graphs Miimum Spaig Trees Slides by Rose Hoberma (CMU) Problem: Layig Telephoe Wire Cetral office 2 Wirig: Naïve Approach Cetral office Expesive! 3 Wirig: Better Approach Cetral office Miimize the total
More informationElementary Educational Computer
Chapter 5 Elemetary Educatioal Computer. Geeral structure of the Elemetary Educatioal Computer (EEC) The EEC coforms to the 5 uits structure defied by vo Neuma's model (.) All uits are preseted i a simplified
More information6.851: Advanced Data Structures Spring Lecture 17 April 24
6.851: Advaced Data Structures Sprig 2012 Prof. Erik Demaie Lecture 17 April 24 Scribes: David Bejami(2012), Li Fei(2012), Yuzhi Zheg(2012),Morteza Zadimoghaddam(2010), Aaro Berstei(2007) 1 Overview Up
More informationDesign and Analysis of Algorithms Notes
Desig ad Aalysis of Algorithms Notes Notes by Wist Course taught by Dr. K Amer Course started: Jauary 4, 013 Course eded: December 13, 01 Curret geeratio: December 18, 013 Listigs 1 Array sum pseudocode.................................
More informationData Structures and Algorithms. Analysis of Algorithms
Data Structures ad Algorithms Aalysis of Algorithms Outlie Ruig time Pseudo-code Big-oh otatio Big-theta otatio Big-omega otatio Asymptotic algorithm aalysis Aalysis of Algorithms Iput Algorithm Output
More informationComputer Science Foundation Exam. August 12, Computer Science. Section 1A. No Calculators! KEY. Solutions and Grading Criteria.
Computer Sciece Foudatio Exam August, 005 Computer Sciece Sectio A No Calculators! Name: SSN: KEY Solutios ad Gradig Criteria Score: 50 I this sectio of the exam, there are four (4) problems. You must
More informationWhat are we going to learn? CSC Data Structures Analysis of Algorithms. Overview. Algorithm, and Inputs
What are we goig to lear? CSC316-003 Data Structures Aalysis of Algorithms Computer Sciece North Carolia State Uiversity Need to say that some algorithms are better tha others Criteria for evaluatio Structure
More informationLecture 1: Introduction and Strassen s Algorithm
5-750: Graduate Algorithms Jauary 7, 08 Lecture : Itroductio ad Strasse s Algorithm Lecturer: Gary Miller Scribe: Robert Parker Itroductio Machie models I this class, we will primarily use the Radom Access
More information. Written in factored form it is easy to see that the roots are 2, 2, i,
CMPS A Itroductio to Programmig Programmig Assigmet 4 I this assigmet you will write a java program that determies the real roots of a polyomial that lie withi a specified rage. Recall that the roots (or
More informationRunning Time. Analysis of Algorithms. Experimental Studies. Limitations of Experiments
Ruig Time Aalysis of Algorithms Iput Algorithm Output A algorithm is a step-by-step procedure for solvig a problem i a fiite amout of time. Most algorithms trasform iput objects ito output objects. The
More informationA Study on the Performance of Cholesky-Factorization using MPI
A Study o the Performace of Cholesky-Factorizatio usig MPI Ha S. Kim Scott B. Bade Departmet of Computer Sciece ad Egieerig Uiversity of Califoria Sa Diego {hskim, bade}@cs.ucsd.edu Abstract Cholesky-factorizatio
More informationCSC165H1 Worksheet: Tutorial 8 Algorithm analysis (SOLUTIONS)
CSC165H1, Witer 018 Learig Objectives By the ed of this worksheet, you will: Aalyse the ruig time of fuctios cotaiig ested loops. 1. Nested loop variatios. Each of the followig fuctios takes as iput a
More informationCopyright 2016 Ramez Elmasri and Shamkant B. Navathe
Copyright 2016 Ramez Elmasri ad Shamkat B. Navathe CHAPTER 19 Query Optimizatio Copyright 2016 Ramez Elmasri ad Shamkat B. Navathe Itroductio Query optimizatio Coducted by a query optimizer i a DBMS Goal:
More informationBig-O Analysis. Asymptotics
Big-O Aalysis 1 Defiitio: Suppose that f() ad g() are oegative fuctios of. The we say that f() is O(g()) provided that there are costats C > 0 ad N > 0 such that for all > N, f() Cg(). Big-O expresses
More informationAnalysis of Algorithms
Aalysis of Algorithms Ruig Time of a algorithm Ruig Time Upper Bouds Lower Bouds Examples Mathematical facts Iput Algorithm Output A algorithm is a step-by-step procedure for solvig a problem i a fiite
More informationUniversity of Waterloo Department of Electrical and Computer Engineering ECE 250 Algorithms and Data Structures
Uiversity of Waterloo Departmet of Electrical ad Computer Egieerig ECE 250 Algorithms ad Data Structures Midterm Examiatio ( pages) Istructor: Douglas Harder February 7, 2004 7:30-9:00 Name (last, first)
More informationLecture 28: Data Link Layer
Automatic Repeat Request (ARQ) 2. Go ack N ARQ Although the Stop ad Wait ARQ is very simple, you ca easily show that it has very the low efficiecy. The low efficiecy comes from the fact that the trasmittig
More informationModule 8-7: Pascal s Triangle and the Binomial Theorem
Module 8-7: Pascal s Triagle ad the Biomial Theorem Gregory V. Bard April 5, 017 A Note about Notatio Just to recall, all of the followig mea the same thig: ( 7 7C 4 C4 7 7C4 5 4 ad they are (all proouced
More information1.2 Binomial Coefficients and Subsets
1.2. BINOMIAL COEFFICIENTS AND SUBSETS 13 1.2 Biomial Coefficiets ad Subsets 1.2-1 The loop below is part of a program to determie the umber of triagles formed by poits i the plae. for i =1 to for j =
More informationChapter 11. Friends, Overloaded Operators, and Arrays in Classes. Copyright 2014 Pearson Addison-Wesley. All rights reserved.
Chapter 11 Frieds, Overloaded Operators, ad Arrays i Classes Copyright 2014 Pearso Addiso-Wesley. All rights reserved. Overview 11.1 Fried Fuctios 11.2 Overloadig Operators 11.3 Arrays ad Classes 11.4
More informationOctahedral Graph Scaling
Octahedral Graph Scalig Peter Russell Jauary 1, 2015 Abstract There is presetly o strog iterpretatio for the otio of -vertex graph scalig. This paper presets a ew defiitio for the term i the cotext of
More informationAnalysis of Algorithms
Presetatio for use with the textbook, Algorithm Desig ad Applicatios, by M. T. Goodrich ad R. Tamassia, Wiley, 2015 Aalysis of Algorithms Iput 2015 Goodrich ad Tamassia Algorithm Aalysis of Algorithms
More informationHash Tables. Presentation for use with the textbook Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 2015.
Presetatio for use with the textbook Algorithm Desig ad Applicatios, by M. T. Goodrich ad R. Tamassia, Wiley, 2015 Hash Tables xkcd. http://xkcd.com/221/. Radom Number. Used with permissio uder Creative
More information9.1. Sequences and Series. Sequences. What you should learn. Why you should learn it. Definition of Sequence
_9.qxd // : AM Page Chapter 9 Sequeces, Series, ad Probability 9. Sequeces ad Series What you should lear Use sequece otatio to write the terms of sequeces. Use factorial otatio. Use summatio otatio to
More informationLoad balanced Parallel Prime Number Generator with Sieve of Eratosthenes on Cluster Computers *
Load balaced Parallel Prime umber Geerator with Sieve of Eratosthees o luster omputers * Soowook Hwag*, Kyusik hug**, ad Dogseug Kim* *Departmet of Electrical Egieerig Korea Uiversity Seoul, -, Rep. of
More informationLecture 2: Spectra of Graphs
Spectral Graph Theory ad Applicatios WS 20/202 Lecture 2: Spectra of Graphs Lecturer: Thomas Sauerwald & He Su Our goal is to use the properties of the adjacecy/laplacia matrix of graphs to first uderstad
More informationA graphical view of big-o notation. c*g(n) f(n) f(n) = O(g(n))
ca see that time required to search/sort grows with size of We How do space/time eeds of program grow with iput size? iput. time: cout umber of operatios as fuctio of iput Executio size operatio Assigmet:
More informationLecture 6. Lecturer: Ronitt Rubinfeld Scribes: Chen Ziv, Eliav Buchnik, Ophir Arie, Jonathan Gradstein
068.670 Subliear Time Algorithms November, 0 Lecture 6 Lecturer: Roitt Rubifeld Scribes: Che Ziv, Eliav Buchik, Ophir Arie, Joatha Gradstei Lesso overview. Usig the oracle reductio framework for approximatig
More informationBasic allocator mechanisms The course that gives CMU its Zip! Memory Management II: Dynamic Storage Allocation Mar 6, 2000.
5-23 The course that gives CM its Zip Memory Maagemet II: Dyamic Storage Allocatio Mar 6, 2000 Topics Segregated lists Buddy system Garbage collectio Mark ad Sweep Copyig eferece coutig Basic allocator
More informationComputers and Scientific Thinking
Computers ad Scietific Thikig David Reed, Creighto Uiversity Chapter 15 JavaScript Strigs 1 Strigs as Objects so far, your iteractive Web pages have maipulated strigs i simple ways use text box to iput
More informationImproved Random Graph Isomorphism
Improved Radom Graph Isomorphism Tomek Czajka Gopal Paduraga Abstract Caoical labelig of a graph cosists of assigig a uique label to each vertex such that the labels are ivariat uder isomorphism. Such
More informationAlgorithm Design Techniques. Divide and conquer Problem
Algorithm Desig Techiques Divide ad coquer Problem Divide ad Coquer Algorithms Divide ad Coquer algorithm desig works o the priciple of dividig the give problem ito smaller sub problems which are similar
More informationOperating System Concepts. Operating System Concepts
Chapter 4: Mass-Storage Systems Logical Disk Structure Logical Disk Structure Disk Schedulig Disk Maagemet RAID Structure Disk drives are addressed as large -dimesioal arrays of logical blocks, where the
More informationDATA STRUCTURES. amortized analysis binomial heaps Fibonacci heaps union-find. Data structures. Appetizer. Appetizer
Data structures DATA STRUCTURES Static problems. Give a iput, produce a output. Ex. Sortig, FFT, edit distace, shortest paths, MST, max-flow,... amortized aalysis biomial heaps Fiboacci heaps uio-fid Dyamic
More informationMinimum Spanning Trees
Miimum Spaig Trees Miimum Spaig Trees Spaig subgraph Subgraph of a graph G cotaiig all the vertices of G Spaig tree Spaig subgraph that is itself a (free) tree Miimum spaig tree (MST) Spaig tree of a weighted
More informationThreads and Concurrency in Java: Part 1
Cocurrecy Threads ad Cocurrecy i Java: Part 1 What every computer egieer eeds to kow about cocurrecy: Cocurrecy is to utraied programmers as matches are to small childre. It is all too easy to get bured.
More informationquality/quantity peak time/ratio
Semi-Heap ad Its Applicatios i Touramet Rakig Jie Wu Departmet of omputer Sciece ad Egieerig Florida Atlatic Uiversity oca Rato, FL 3343 jie@cse.fau.edu September, 00 . Itroductio ad Motivatio. relimiaries
More informationOnes Assignment Method for Solving Traveling Salesman Problem
Joural of mathematics ad computer sciece 0 (0), 58-65 Oes Assigmet Method for Solvig Travelig Salesma Problem Hadi Basirzadeh Departmet of Mathematics, Shahid Chamra Uiversity, Ahvaz, Ira Article history:
More informationOutline and Reading. Analysis of Algorithms. Running Time. Experimental Studies. Limitations of Experiments. Theoretical Analysis
Outlie ad Readig Aalysis of Algorithms Iput Algorithm Output Ruig time ( 3.) Pseudo-code ( 3.2) Coutig primitive operatios ( 3.3-3.) Asymptotic otatio ( 3.6) Asymptotic aalysis ( 3.7) Case study Aalysis
More informationThreads and Concurrency in Java: Part 1
Threads ad Cocurrecy i Java: Part 1 1 Cocurrecy What every computer egieer eeds to kow about cocurrecy: Cocurrecy is to utraied programmers as matches are to small childre. It is all too easy to get bured.
More informationUNIVERSITY OF MORATUWA
UNIVERSITY OF MORATUWA FACULTY OF ENGINEERING DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING B.Sc. Egieerig 2014 Itake Semester 2 Examiatio CS2052 COMPUTER ARCHITECTURE Time allowed: 2 Hours Jauary 2016
More informationChapter 1. Introduction to Computers and C++ Programming. Copyright 2015 Pearson Education, Ltd.. All rights reserved.
Chapter 1 Itroductio to Computers ad C++ Programmig Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 1.1 Computer Systems 1.2 Programmig ad Problem Solvig 1.3 Itroductio to C++ 1.4 Testig
More information2. ALGORITHM ANALYSIS
2. ALGORITHM ANALYSIS computatioal tractability survey of commo ruig times 2. ALGORITHM ANALYSIS computatioal tractability survey of commo ruig times Lecture slides by Kevi Waye Copyright 2005 Pearso-Addiso
More informationBig-O Analysis. Asymptotics
Big-O Aalysis 1 Defiitio: Suppose that f() ad g() are oegative fuctios of. The we say that f() is O(g()) provided that there are costats C > 0 ad N > 0 such that for all > N, f() Cg(). Big-O expresses
More informationGreedy Algorithms. Interval Scheduling. Greedy Algorithms. Interval scheduling. Greedy Algorithms. Interval Scheduling
Greedy Algorithms Greedy Algorithms Witer Paul Beame Hard to defie exactly but ca give geeral properties Solutio is built i small steps Decisios o how to build the solutio are made to maximize some criterio
More informationOne advantage that SONAR has over any other music-sequencing product I ve worked
*gajedra* D:/Thomso_Learig_Projects/Garrigus_163132/z_productio/z_3B2_3D_files/Garrigus_163132_ch17.3d, 14/11/08/16:26:39, 16:26, page: 647 17 CAL 101 Oe advatage that SONAR has over ay other music-sequecig
More informationprerequisites: 6.046, 6.041/2, ability to do proofs Randomized algorithms: make random choices during run. Main benefits:
Itro Admiistrivia. Sigup sheet. prerequisites: 6.046, 6.041/2, ability to do proofs homework weekly (first ext week) collaboratio idepedet homeworks gradig requiremet term project books. questio: scribig?
More informationMajor CSL Write your name and entry no on every sheet of the answer script. Time 2 Hrs Max Marks 70
NOTE:. Attempt all seve questios. Major CSL 02 2. Write your ame ad etry o o every sheet of the aswer script. Time 2 Hrs Max Marks 70 Q No Q Q 2 Q 3 Q 4 Q 5 Q 6 Q 7 Total MM 6 2 4 0 8 4 6 70 Q. Write a
More informationCS 683: Advanced Design and Analysis of Algorithms
CS 683: Advaced Desig ad Aalysis of Algorithms Lecture 6, February 1, 2008 Lecturer: Joh Hopcroft Scribes: Shaomei Wu, Etha Feldma February 7, 2008 1 Threshold for k CNF Satisfiability I the previous lecture,
More informationCMSC Computer Architecture Lecture 12: Virtual Memory. Prof. Yanjing Li University of Chicago
CMSC 22200 Computer Architecture Lecture 12: Virtual Memory Prof. Yajig Li Uiversity of Chicago A System with Physical Memory Oly Examples: most Cray machies early PCs Memory early all embedded systems
More informationCourse Site: Copyright 2012, Elsevier Inc. All rights reserved.
Course Site: http://cc.sjtu.edu.c/g2s/site/aca.html 1 Computer Architecture A Quatitative Approach, Fifth Editio Chapter 2 Memory Hierarchy Desig 2 Outlie Memory Hierarchy Cache Desig Basic Cache Optimizatios
More informationComputational Geometry
Computatioal Geometry Chapter 4 Liear programmig Duality Smallest eclosig disk O the Ageda Liear Programmig Slides courtesy of Craig Gotsma 4. 4. Liear Programmig - Example Defie: (amout amout cosumed
More informationCMPT 125 Assignment 2 Solutions
CMPT 25 Assigmet 2 Solutios Questio (20 marks total) a) Let s cosider a iteger array of size 0. (0 marks, each part is 2 marks) it a[0]; I. How would you assig a poiter, called pa, to store the address
More informationMulti-Pivot Quicksort: Theory and Experiments
Abstract Multi-Pivot Quicksort: Theory ad Experimets Shriu Kushagra skushagr@uwaterloo.ca Uiversity of Waterloo The idea of multi-pivot quicksort has recetly received the attetio of researchers after Vladimir
More informationProject 2.5 Improved Euler Implementation
Project 2.5 Improved Euler Implemetatio Figure 2.5.10 i the text lists TI-85 ad BASIC programs implemetig the improved Euler method to approximate the solutio of the iitial value problem dy dx = x+ y,
More informationCOMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface. Chapter 4. The Processor. Part A Datapath Design
COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Iterface 5 th Editio Chapter The Processor Part A path Desig Itroductio CPU performace factors Istructio cout Determied by ISA ad compiler. CPI ad
More informationAlgorithm. Counting Sort Analysis of Algorithms
Algorithm Coutig Sort Aalysis of Algorithms Assumptios: records Coutig sort Each record cotais keys ad data All keys are i the rage of 1 to k Space The usorted list is stored i A, the sorted list will
More informationAvid Interplay Bundle
Avid Iterplay Budle Versio 2.5 Cofigurator ReadMe Overview This documet provides a overview of Iterplay Budle v2.5 ad describes how to ru the Iterplay Budle cofiguratio tool. Iterplay Budle v2.5 refers
More informationECE4050 Data Structures and Algorithms. Lecture 6: Searching
ECE4050 Data Structures ad Algorithms Lecture 6: Searchig 1 Search Give: Distict keys k 1, k 2,, k ad collectio L of records of the form (k 1, I 1 ), (k 2, I 2 ),, (k, I ) where I j is the iformatio associated
More informationPriority Queues. Binary Heaps
Priority Queues Biary Heaps Priority Queues Priority: some property of a object that allows it to be prioritized with respect to other objects of the same type Mi Priority Queue: homogeeous collectio of
More informationSymmetric Class 0 subgraphs of complete graphs
DIMACS Techical Report 0-0 November 0 Symmetric Class 0 subgraphs of complete graphs Vi de Silva Departmet of Mathematics Pomoa College Claremot, CA, USA Chaig Verbec, Jr. Becer Friedma Istitute Booth
More information