CS221: Algorithms and Data Structures. Priority Queues and Heaps. Alan J. Hu (Borrowing slides from Steve Wolfman)
|
|
- Arron Warner
- 5 years ago
- Views:
Transcription
1 CS: Algorthms and Data Structures Prorty Queues and Heaps Alan J. Hu (Borrowng sldes from Steve Wolfman)
2 Learnng Goals After ths unt, you should be able to: Provde examples of approprate applcatons for prorty queues and heaps Manpulate data n heaps Descrbe and apply the Heapfy algorthm, and analyze ts complexty
3 Today s Outlne Trees, Brefly Prorty Queue ADT Heaps Implementng Prorty Queue ADT Focus on Create: Heapfy Bref ntroducton to d-heaps 3
4 Tree Termnology root: leaf: chld: parent: sblng: ancestor: descendent: subtree: D B E A F H C G I J K L M N 4
5 Tree Termnology Reference root: the sngle node wth no parent leaf: a node wth no chldren chld: a node ponted to by me B parent: the node that ponts to me sblng: another chld of my parent D E ancestor: my parent or my parent s ancestor descendent: my chld or my chld s descendent subtree: a node and ts descendents A F H C G I We sometmes use degenerate versons J K L M N of these defntons that allow NULL as the empty tree. (Ths can be very handy for recursve base cases!) 5
6 More Tree Termnology depth: # of edges along path from root to node depth of H? B A C D E F G H I J K L M N 6
7 More Tree Termnology heght: # of edges along longest path from node to leaf or, for whole tree, from root to leaf heght of tree? B A C D E F G H I J K L M N 7
8 More Tree Termnology degree: # of chldren of a node degree of B? B A C D E F G H I J K L M N 8
9 More Tree Termnology branchng factor: maxmum degree of any node n the tree for bnary trees, our usual concern; 5 for ths werd tree D B E A F C G H I J K L M N 9
10 One More Tree Termnology Slde bnary: branchng factor of (each chld has at most chldren) A n-ary: branchng factor of n B C complete: packed bnary tree; as many nodes as possble for ts heght H D I J E F G 0 nearly complete: complete plus some nodes on the left at the bottom
11 Trees and (Structural) Recurson A tree s ether: the empty tree a root node and an ordered lst of subtrees Trees are a recursvely defned structure, so t makes sense to operate on them recursvely.
12 Today s Outlne Trees, Brefly Prorty Queue ADT Heaps Implementng Prorty Queue ADT Focus on Create: Heapfy Bref ntroducton to d-heaps
13 Back to Queues Some applcatons orderng CPU jobs smulatng events pckng the next search ste Problems? short jobs should go frst earlest (smulated tme) events should go frst most promsng stes should be searched frst 3
14 Prorty Queue ADT Prorty Queue operatons create destroy nsert deletemn sempty G(9) nsert F(7) E(5) D(00) A(4) B(6) deletemn Prorty Queue property: for two elements n the queue, x and y, f x has a lower prorty value than y, x wll be deleted before y C(3) 4
15 Applcatons of the Prorty Q Hold jobs for a prnter n order of length Store packets on network routers n order of urgency Smulate events Select symbols for compresson Sort numbers Anythng greedy: an algorthm that makes the locally best choce at each step 5
16 Naïve Prorty Q Data Structures Unsorted lst: nsert: deletemn: Sorted lst: nsert: deletemn: a. O(lg n) b. O(n) c. O(n lg n) d. O(n ) e. Somethng else 6
17 Today s Outlne Trees, Brefly Prorty Queue ADT Heaps Implementng Prorty Queue ADT Focus on Create: Heapfy Bref ntroducton to d-heaps 7
18 Bnary Heap Prorty Q Data Structure Heap-order property parent s key s less than or equal to chldren s keys result: mnmum s always at the top Structure property nearly complete tree result: depth s always O(log n); next open locaton always known 7 Look! Invarants! WARNING: ths has NO SIMILARITY to the heap you hear about 8 when people say objects you create wth new go on the heap.
19 Nfty Storage Trck Calculatons: chld: parent: root: next free:
20 (Asde: Steve numbers from.) Calculatons: chld: parent: root: next free: Steve lke to just skp usng entry 0 n the array, so the root s at ndex. 0 For a bnary heap, ths makes the calculatons slghtly shorter.
21 DeleteMn pqueue.deletemn()? Invarants volated! DOOOM!!!
22 Percolate Down ? ? ?
23 Fnally
24 DeleteMn Code Object deletemn() { assert(!sempty()); returnval Heap[0]; sze--; newpos percolatedown(0, Heap[sze]); Heap[newPos] Heap[sze]; return returnval; } runtme: nt percolatedown(nt hole, Object val) { whle (*hole+ < sze) { left *hole + ; rght left + ; f (rght < sze && Heap[rght] < Heap[left]) target rght; else target left; } f (Heap[target] < val) { Heap[hole] Heap[target]; hole target; } else break; } return hole; 4
25 Insert pqueue.nsert(3) Invarant volated! What wll we do? 5
26 Percolate Up
27 Insert Code vod nsert(object o) { assert(!sfull()); newpos percolateup(sze,o); sze++; Heap[newPos] o; } nt percolateup(nt hole, Object val) { whle (hole > 0 && val < Heap[(hole-)/]) Heap[hole] Heap[(hole-)/]; hole (hole-)/; } return hole; } runtme: 7
28 Today s Outlne Trees, Brefly Prorty Queue ADT Heaps Implementng Prorty Queue ADT Focus on Create: Heapfy Bref ntroducton to d-heaps 8
29 Closer Look at Creatng Heaps To create a heap gven a lst of tems: Create an empty heap. For each tem: nsert nto heap. Tme complexty? a. O(lg n) b. O(n) 9, 4, 8,, 7, 3 c. O(n lg n) 5 d. O(n ) e. None of these 0 9 3
30 A Better BuldHeap Floyd s Method. Thank you, Floyd pretend t s a heap and fx the heap-order property! Invarant volated! Where can the order nvarant be volated n general? a. Anywhere b. Non-leaves c. Non-roots
31 Alan s Asde: I don t really lke the way Steve explans ths. Heaps are recursve (mostly, except for structure): A sngle node s a heap. If parent value less than ts chld(ren), and chld(ren) are heaps (except for nearly complete property). Thnk of enforcng the heap nvarant from the bottom up! Base Case: All nodes wth no chldren are heaps already. Inductve Case: My chldren are heaps. Percolate my value down, and that makes me a heap, too.
32 Buld(ths)Heap
33 Fnally runtme: 33
34 Buld(any)Heap Ths s as many volatons as we can get. How do we fx them? Let s play colourng games! 34
35 Buld(any)Heap Alan s Asde: I lke to thnk of ths nstead as chargng edges n the tree for the cost of the moves. We can work out a scheme where each edge pays only once. (A - correspondence!) 35
36 Buld(any)Heap Alan s Asde: The proof that ths always works s nductve. The nductve step s that both of my subtrees have an uncharged path (rghtmost) to the leaves. I charge my cost to my left chld, and my rght chld provdes the rghtmost, uncharged path that I offer to my parent. 36
37 Alan s Asde Alternatvely, we can do ths wth algebra. Consder a complete heap: As we do percolate-down on bottom row, the cost s 0, each. There are roughly n/ nodes on bottom row. On next row up, the cost s, each. There are roughly n/4 nodes on second row. On the kth row up, the cost s k- tmes n/(^k) nodes on that row. logn n n n Therefore, run tme s n ( ) + 0 0
38 Alan s Asde The last sum s trcky Thnk of the s as +; the 3s, as ++; etc. Now, add up a layer of s for the whole tree. Then, add up a layer of s for the part of the tree where the cost was or more. Then, add up a layer of s for the part of the tree where the cost was 3 or more. Etc.
39 Alan s Asde
40 Alan s Asde j j j j j j
41 Steve s Verson of Alan s Asde ( ) S S
42 Today s Outlne Trees, Brefly Prorty Queue ADT Heaps Implementng Prorty Queue ADT Focus on Create: Heapfy Bref ntroducton to d-heaps 4
43 Thnkng about Bnary Heaps Observatons fndng a chld/parent ndex s a multply/dvde by two operatons jump wdely through the heap deletemns look at all (two) chldren of some nodes nserts only care about parents of some nodes nserts are at least as common as deletemns Realtes dvson and multplcaton by powers of two are fast lookng at one new pece of data sucks n a cache lne wth huge data sets, dsk accesses domnate 43
44 Soluton: d-heaps Nodes have (up to) d chldren Stll representable by array Good choces for d: optmze (non-asymptotc) performance based on rato of nserts/removes make d a power of two for effcency ft one set of chldren n a cache lne ft one set of chldren on a memory page/dsk block d-heap mnemonc: d s for degree! 44
45 d-heap calculatons Calculatons n terms of d: chld: parent: 3 7 root: next free: Alan s Asde: Easer to work pattern f you count from zero! d-heap mnemonc: d s for degree! 45
46 d-heap calculatons Calculatons n terms of d: chld: d*+ through d*+d parent: floor((-)/d) 3 7 root: next free: sze Alan s Asde: Easer to work pattern f you count from zero! d-heap mnemonc: d s for degree! 46
47 (Steve s d-heap calculatons) Calculatons n terms of d: chld: parent: 3 7 root: next free: d-heap mnemonc: d s for degree! 47
48 (Steve s d-heap calculatons) Calculatons n terms of d: chld: (-)*d+ through *d+ parent: floor((-)/d) root: next free: sze d-heap mnemonc: d s for degree! 48
49 Rest of Today s Learnng Goals Get comfortable wth C++ ponters, understand the * and & operators. Draw dagrams to help understand code that manpulates ponters. 49
50 C++ Reference Parameters & n a formal parameter makes the parameter another name for the argument that was passed n! (Ths s a totally dfferent meanng of & from the address of operator (and also totally dfferent from btwse-and).) It s not a copy of the value of the argument, the way normal parameter passng works.
51 C++ Reference Parameters vod swap(nt x, nt y) { nt t x; x y; y t; } nt a0; nt b; swap(a,b); cout << a <<, << b; vod swap(nt &x, nt &y) { nt t x; x y; y t; } nt a0; nt b; swap(a,b); cout << a <<, << b;
52 C++ Reference Parameters vod swap(nt x, nt y) { nt t x; x y; y t; } nt a0; nt b; swap(a,b); cout << a <<, << b; vod swap(nt &x, nt &y) { nt t x; x y; y t; } nt a0; nt b; swap(a,b); cout << a <<, << b;
53 Old-School C (and C++) vod swap(nt *x, nt *y) { nt *t x; x y; y t; } nt a0; nt b; swap(a,b); cout << a <<, << b; vod swap(nt *x, nt *y) { nt t *x; *x *y; *y t; } nt a0; nt b; swap(a,b); cout << a <<, << b;
54 Old-School C (and C++) vod swap(nt *x, nt *y) { nt *t x; x y; y t; } nt a0; nt b; swap(a,b); cout << a <<, << b; vod swap(nt *x, nt *y) { nt t *x; *x *y; *y t; } nt a0; nt b; swap(a,b); cout << a <<, << b;
55 Old-School C (and C++) vod swap(nt *x, nt *y) { nt t *x; *x *y; *y t; } nt a0; nt b; swap(&a,&b); cout << a <<, << b; vod swap(nt *x, nt *y) { nt t *x; *x *y; *y t; } nt a0; nt b; swap(a,b); cout << a <<, << b;
56 Old-School C (and C++) vod swap(nt *x, nt *y) { nt t *x; *x *y; *y t; } nt a0; nt b; swap(&a,&b); cout << a <<, << b; vod swap(nt *x, nt *y) { nt t *x; *x *y; *y t; } nt a0; nt b; swap(a,b); cout << a <<, << b;
Learning Goals. CS221: Algorithms and Data Structures Lecture #3 Mind Your Priority Queues. Today s Outline. Back to Queues. Priority Queue ADT
CS: Algorithms and Data Structures Lecture # Mind Your Priority Queues Steve Wolfman 0W Learning Goals Provide examples of appropriate applications for priority queues. Describe efficient implementations
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 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 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 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 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 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 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 informationToday s Outline. The One Page Cheat Sheet. Simplifying Recurrences. Set Notation. Set Notation. Priority Queues. O( 2 n ) O( n 3 )
Priority Queues (Today: inary Min Heaps) hapter in Weiss SE Data Structures Ruth Anderson Winter 0 //0 Today s Outline Announcements Project #, due pm Wed Jan. Written Assignment # posted, due at the beginning
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 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 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 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 informationUnit #2: Priority Queues
Unit #2: Priority Queues CPSC 221: Algorithms and Data Structures Will Evans 201W1 Unit Outline Rooted Trees, Briefly Priority Queue ADT Heaps Implementing Priority Queue ADT Focus on Create: Heapify Brief
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 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 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 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 informationSorting: The Big Picture. The steps of QuickSort. QuickSort Example. QuickSort Example. QuickSort Example. Recursive Quicksort
Sortng: The Bg Pcture Gven n comparable elements n an array, sort them n an ncreasng (or decreasng) order. Smple algorthms: O(n ) Inserton sort Selecton sort Bubble sort Shell sort Fancer algorthms: O(n
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 informationCMPS 10 Introduction to Computer Science Lecture Notes
CPS 0 Introducton to Computer Scence Lecture Notes Chapter : Algorthm Desgn How should we present algorthms? Natural languages lke Englsh, Spansh, or French whch are rch n nterpretaton and meanng are not
More 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 informationMore on Sorting: Quick Sort and Heap Sort
More on Sortng: Quck Sort and Heap Sort Antono Carzanga Faculty of Informatcs Unversty of Lugano October 12, 2007 c 2006 Antono Carzanga 1 Another dvde-and-conuer sortng algorthm The heap Heap sort Outlne
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 informationThe AVL Balance Condition. CSE 326: Data Structures. AVL Trees. The AVL Tree Data Structure. Is this an AVL Tree? Height of an AVL Tree
CSE : Data Structures AL Trees Neva Cernavsy Summer Te AL Balance Condton AL balance property: Left and rgt subtrees of every node ave egts dfferng by at most Ensures small dept ll prove ts by sowng tat
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 informationCSE 326: Data Structures Lecture #4 Heaps more Priority Qs. Today s Outline
CSE : Data Structures Lecture # Heaps more Priority Qs Bart Niswonger Summer Quarter Today s Outline Return quizzes Things Bart Didn t Finish on Friday (insert & d-heaps) Leftist Heaps Skew Heaps Comparing
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 informationCHAPTER 10: ALGORITHM DESIGN TECHNIQUES
CHAPTER 10: ALGORITHM DESIGN TECHNIQUES So far, we have been concerned wth the effcent mplementaton of algorthms. We have seen that when an algorthm s gven, the actual data structures need not be specfed.
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 informationBrave New World Pseudocode Reference
Brave New World Pseudocode Reference Pseudocode s a way to descrbe how to accomplsh tasks usng basc steps lke those a computer mght perform. In ths week s lab, you'll see how a form of pseudocode can be
More informationKent State University CS 4/ Design and Analysis of Algorithms. Dept. of Math & Computer Science LECT-16. Dynamic Programming
CS 4/560 Desgn and Analyss of Algorthms Kent State Unversty Dept. of Math & Computer Scence LECT-6 Dynamc Programmng 2 Dynamc Programmng Dynamc Programmng, lke the dvde-and-conquer method, solves problems
More informationAdministration CSE 326: Data Structures
Administration SE : Data Structures Priority Queues and inary Heaps Due tonight: Project Released today: Project, phase A Due Wednesday: Homework Released Wednesday: Homework ary has office hours tomorrow
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 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 informationSorting. Sorted Original. index. index
1 Unt 16 Sortng 2 Sortng Sortng requres us to move data around wthn an array Allows users to see and organze data more effcently Behnd the scenes t allows more effectve searchng of data There are MANY
More 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 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 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 information1 Dynamic Connectivity
15-850: Advanced Algorthms CMU, Sprng 2017 Lecture #3: Dynamc Graph Connectvty algorthms 01/30/17 Lecturer: Anupam Gupta Scrbe: Hu Han Chn, Jacob Imola Dynamc graph algorthms s the study of standard graph
More informationArray transposition in CUDA shared memory
Array transposton n CUDA shared memory Mke Gles February 19, 2014 Abstract Ths short note s nspred by some code wrtten by Jeremy Appleyard for the transposton of data through shared memory. I had some
More 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 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 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 informationBiostatistics 615/815
The E-M Algorthm Bostatstcs 615/815 Lecture 17 Last Lecture: The Smplex Method General method for optmzaton Makes few assumptons about functon Crawls towards mnmum Some recommendatons Multple startng ponts
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 informationUSING GRAPHING SKILLS
Name: BOLOGY: Date: _ Class: USNG GRAPHNG SKLLS NTRODUCTON: Recorded data can be plotted on a graph. A graph s a pctoral representaton of nformaton recorded n a data table. t s used to show a relatonshp
More informationProgramming Assignment Six. Semester Calendar. 1D Excel Worksheet Arrays. Review VBA Arrays from Excel. Programming Assignment Six May 2, 2017
Programmng Assgnment Sx, 07 Programmng Assgnment Sx Larry Caretto Mechancal Engneerng 09 Computer Programmng for Mechancal Engneers Outlne Practce quz for actual quz on Thursday Revew approach dscussed
More informationMachine Learning: Algorithms and Applications
14/05/1 Machne Learnng: Algorthms and Applcatons Florano Zn Free Unversty of Bozen-Bolzano Faculty of Computer Scence Academc Year 011-01 Lecture 10: 14 May 01 Unsupervsed Learnng cont Sldes courtesy of
More 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 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 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 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 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 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 informationReal-Time Guarantees. Traffic Characteristics. Flow Control
Real-Tme Guarantees Requrements on RT communcaton protocols: delay (response s) small jtter small throughput hgh error detecton at recever (and sender) small error detecton latency no thrashng under peak
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 informationThe stream cipher MICKEY-128 (version 1) Algorithm specification issue 1.0
The stream cpher MICKEY-128 (verson 1 Algorthm specfcaton ssue 1. Steve Babbage Vodafone Group R&D, Newbury, UK steve.babbage@vodafone.com Matthew Dodd Independent consultant matthew@mdodd.net www.mdodd.net
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 informationCSCI2100B Data Structures Heaps
CSCI2100B Data Structures Heaps Irwin King king@cse.cuhk.edu.hk http://www.cse.cuhk.edu.hk/~king Department of Computer Science & Engineering The Chinese University of Hong Kong Introduction In some applications,
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 informationPriority Queues and Binary Heaps. See Chapter 21 of the text, pages
Priority Queues and Binary Heaps See Chapter 21 of the text, pages 807-839. A priority queue is a queue-like data structure that assumes data is comparable in some way (or at least has some field on which
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 informationGreedy Technique - Definition
Greedy Technque Greedy Technque - Defnton The greedy method s a general algorthm desgn paradgm, bult on the follong elements: confguratons: dfferent choces, collectons, or values to fnd objectve functon:
More informationDijkstra s Single Source Algorithm. All-Pairs Shortest Paths. Dynamic Programming Solution. Performance. Decision Sequence.
All-Pars Shortest Paths Gven an n-vertex drected weghted graph, fnd a shortest path from vertex to vertex for each of the n vertex pars (,). Dstra s Sngle Source Algorthm Use Dstra s algorthm n tmes, once
More 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 informationPriority Queues and Binary Heaps. See Chapter 21 of the text, pages
Priority Queues and Binary Heaps See Chapter 21 of the text, pages 807-839. A priority queue is a queue-like data structure that assumes data is comparable in some way (or at least has some field on which
More informationCMSC 341 Lecture 14: Priority Queues, Heaps
CMSC 341 Lecture 14: Priority Queues, Heaps Prof. John Park Based on slides from previous iterations of this course Today s Topics Priority Queues Abstract Data Type Implementations of Priority Queues:
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 informationCS434a/541a: Pattern Recognition Prof. Olga Veksler. Lecture 15
CS434a/541a: Pattern Recognton Prof. Olga Veksler Lecture 15 Today New Topc: Unsupervsed Learnng Supervsed vs. unsupervsed learnng Unsupervsed learnng Net Tme: parametrc unsupervsed learnng Today: nonparametrc
More informationPriority Queues. 1 Introduction. 2 Naïve Implementations. CSci 335 Software Design and Analysis III Chapter 6 Priority Queues. Prof.
Priority Queues 1 Introduction Many applications require a special type of queuing in which items are pushed onto the queue by order of arrival, but removed from the queue based on some other priority
More informationReport on On-line Graph Coloring
2003 Fall Semester Comp 670K Onlne Algorthm Report on LO Yuet Me (00086365) cndylo@ust.hk Abstract Onlne algorthm deals wth data that has no future nformaton. Lots of examples demonstrate that onlne algorthm
More informationHierarchical clustering for gene expression data analysis
Herarchcal clusterng for gene expresson data analyss Gorgo Valentn e-mal: valentn@ds.unm.t Clusterng of Mcroarray Data. Clusterng of gene expresson profles (rows) => dscovery of co-regulated and functonally
More informationDynamic Programming. Example - multi-stage graph. sink. source. Data Structures &Algorithms II
Dynamc Programmng Example - mult-stage graph 1 source 9 7 3 2 2 3 4 5 7 11 4 11 8 2 2 1 6 7 8 4 6 3 5 6 5 9 10 11 2 4 5 12 snk Data Structures &Algorthms II A labeled, drected graph Vertces can be parttoned
More informationCSE373: Data Structures & Algorithms Lecture 9: Priority Queues and Binary Heaps. Linda Shapiro Spring 2016
CSE373: Data Structures & Algorithms Lecture : Priority Queues and Binary Heaps Linda Shapiro Spring 2016 A new ADT: Priority Queue A priority queue holds compare-able data Like dictionaries, we need to
More informationPriority Queues. Binary Heaps
Priority Queues An internet router receives data packets, and forwards them in the direction of their destination. When the line is busy, packets need to be queued. Some data packets have higher priority
More informationAnnouncements. Supervised Learning
Announcements See Chapter 5 of Duda, Hart, and Stork. Tutoral by Burge lnked to on web page. Supervsed Learnng Classfcaton wth labeled eamples. Images vectors n hgh-d space. Supervsed Learnng Labeled eamples
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 informationCMSC 341 Priority Queues & Heaps. Based on slides from previous iterations of this course
CMSC 341 Priority Queues & Heaps Based on slides from previous iterations of this course Today s Topics Priority Queues Abstract Data Type Implementations of Priority Queues: Lists BSTs Heaps Heaps Properties
More informationNGPM -- A NSGA-II Program in Matlab
Verson 1.4 LIN Song Aerospace Structural Dynamcs Research Laboratory College of Astronautcs, Northwestern Polytechncal Unversty, Chna Emal: lsssswc@163.com 2011-07-26 Contents Contents... 1. Introducton...
More informationEfficient Processing of Ordered XML Twig Pattern
Effcent Processng of Ordered XML Twg Pattern Jaheng Lu, Tok Wang Lng, Tan Yu, Changqng L, and We N School of computng, Natonal Unversty of Sngapore {lujahen, lngtw, yutan, lchangq, nwe}@comp.nus.edu.sg
More informationCS 268: Lecture 8 Router Support for Congestion Control
CS 268: Lecture 8 Router Support for Congeston Control Ion Stoca Computer Scence Dvson Department of Electrcal Engneerng and Computer Scences Unversty of Calforna, Berkeley Berkeley, CA 9472-1776 Router
More informationMATHEMATICS FORM ONE SCHEME OF WORK 2004
MATHEMATICS FORM ONE SCHEME OF WORK 2004 WEEK TOPICS/SUBTOPICS LEARNING OBJECTIVES LEARNING OUTCOMES VALUES CREATIVE & CRITICAL THINKING 1 WHOLE NUMBER Students wll be able to: GENERICS 1 1.1 Concept of
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 informationEfficient Distributed File System (EDFS)
Effcent Dstrbuted Fle System (EDFS) (Sem-Centralzed) Debessay(Debsh) Fesehaye, Rahul Malk & Klara Naherstedt Unversty of Illnos-Urbana Champagn Contents Problem Statement, Related Work, EDFS Desgn Rate
More informationBayesian Networks: Independencies and Inference. What Independencies does a Bayes Net Model?
Bayesan Networks: Indeendences and Inference Scott Daves and Andrew Moore Note to other teachers and users of these sldes. Andrew and Scott would be delghted f you found ths source materal useful n gvng
More informationReadings. Priority Queue ADT. FindMin Problem. Priority Queues & Binary Heaps. List implementation of a Priority Queue
Readings Priority Queues & Binary Heaps Chapter Section.-. CSE Data Structures Winter 00 Binary Heaps FindMin Problem Quickly find the smallest (or highest priority) item in a set Applications: Operating
More informationc 2009 Society for Industrial and Applied Mathematics
SIAM J. MATRIX ANAL. APPL. Vol. 31, No. 3, pp. 1382 1411 c 2009 Socety for Industral and Appled Mathematcs SUPERFAST MULTIFRONTAL METHOD FOR LARGE STRUCTURED LINEAR SYSTEMS OF EQUATIONS JIANLIN XIA, SHIVKUMAR
More informationCSE 332: Data Structures & Parallelism Lecture 3: Priority Queues. Ruth Anderson Winter 2019
CSE 332: Data Structures & Parallelism Lecture 3: Priority Queues Ruth Anderson Winter 201 Today Finish up Intro to Asymptotic Analysis New ADT! Priority Queues 1/11/201 2 Scenario What is the difference
More informationLecture 15: Memory Hierarchy Optimizations. I. Caches: A Quick Review II. Iteration Space & Loop Transformations III.
Lecture 15: Memory Herarchy Optmzatons I. Caches: A Quck Revew II. Iteraton Space & Loop Transformatons III. Types of Reuse ALSU 7.4.2-7.4.3, 11.2-11.5.1 15-745: Memory Herarchy Optmzatons Phllp B. Gbbons
More informationRecall: Properties of B-Trees
CSE 326 Lecture 10: B-Trees and Heaps It s lunch time what s cookin? B-Trees Insert/Delete Examples and Run Time Analysis Summary of Search Trees Introduction to Heaps and Priority Queues Covered in Chapters
More informationParallel Numerics. 1 Preconditioning & Iterative Solvers (From 2016)
Technsche Unverstät München WSe 6/7 Insttut für Informatk Prof. Dr. Thomas Huckle Dpl.-Math. Benjamn Uekermann Parallel Numercs Exercse : Prevous Exam Questons Precondtonng & Iteratve Solvers (From 6)
More informationCPSC 221: Data Structures Lecture #5. CPSC 221: Data Structures Lecture #5. Learning Goals. Today s Outline. Tree Terminology.
PS 1: Data Structures ecture # ranching Out Steve Wolfman 0W1 PS 1: Data Structures ecture # ranching Out Steve Wolfman 0W1 earning Goals fter this unit, you should be able to... Determine if a given tree
More informationDijkstra s Single Source Algorithm. All-Pairs Shortest Paths. Dynamic Programming Solution. Performance
All-Pars Shortest Paths Gven an n-vertex drected weghted graph, fnd a shortest path from vertex to vertex for each of the n vertex pars (,). Dkstra s Sngle Source Algorthm Use Dkstra s algorthm n tmes,
More informationThe example below contains two doors and no floor level obstacles. Your panel calculator should now look something like this: 2,400
Step 1: A r c h t e c t u r a l H e a t n g o begn wth you must prepare a smple drawng for each room n whch you wsh to nstall our Heat Profle Skrtng Heatng System. You certanly don't need to be Pcasso,
More 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 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 informationMotivation. EE 457 Unit 4. Throughput vs. Latency. Performance Depends on View Point?! Computer System Performance. An individual user wants to:
4.1 4.2 Motvaton EE 457 Unt 4 Computer System Performance An ndvdual user wants to: Mnmze sngle program executon tme A datacenter owner wants to: Maxmze number of Mnmze ( ) http://e-tellgentnternetmarketng.com/webste/frustrated-computer-user-2/
More informationSlide 1 SPH3UW: OPTICS I. Slide 2. Slide 3. Introduction to Mirrors. Light incident on an object
Slde 1 SPH3UW: OPTICS I Introducton to Mrrors Slde 2 Lght ncdent on an object Absorpton Relecton (bounces)** See t Mrrors Reracton (bends) Lenses Oten some o each Everythng true or wavelengths
More informationCache Performance 3/28/17. Agenda. Cache Abstraction and Metrics. Direct-Mapped Cache: Placement and Access
Agenda Cache Performance Samra Khan March 28, 217 Revew from last lecture Cache access Assocatvty Replacement Cache Performance Cache Abstracton and Metrcs Address Tag Store (s the address n the cache?
More information