Lecture VIII Keywords: tree-based data structures; binary search trees; red/black trees; flexible functional arrays; heaps; priority queues.
|
|
- Junior Brooks
- 6 years ago
- Views:
Transcription
1 Bar search trees Lecture VIII Kewords: tree-based data structures; bar search trees; red/black trees; fleible functional arras; heaps; priorit queues. References: [MLWP, Chapters 4 and 7] [PFDS, Chapters 2( 2), 3( 3), and 5( 2)] A bar search tree is a bar tree with nodes where data items are stored with the propert that, Thus, for ever node the tree, the elements of the left subtree are smaller than or equal to that of the node which turn is smaller than the elements of the right subtree. the order listg of a bar search tree is a sorted list. / 1 / 2 Applications: 1. Bar search trees offer a simple wa to represent sets; which case, to elimate repetitions, it is natural to impose the etra condition that elements of left subtrees are strictl smaller than their respective roots. When balanced, the admit O(n log n) runtime for all basic operations. 2. Bar search trees can also be easil etended to act as dictionaries, mappg kes to values. We can test membership a bar search tree usg lookup: fun lookup empt = false lookup ( node(v,l,r) ) = ( = v ) orelse ( if < v then (lookup l) else ( lookup r ) ) ; val lookup = fn : t -> t tree -> bool / 3 / 4
2 To sert a new value, we just need to fd its proper place: fun sert empt = node(, empt, empt ) sert ( node(v,l,r) ) = if <= v then node( v, sert l, r ) else node( v, l, sert r ) ; val sert = fn : t -> t tree -> t tree We could thus sort a list b the followg procedure: val sort = order o ( foldl ( fn(,t) => sert t ) empt ) ; val sort = fn : t list -> t list Red/Black trees Bar search trees are simple and perform well on random or unordered data, but the perform poorl on ordered data, degradg to O(n) performance for common operations. Red/black trees are a popular famil of balanced bar search trees. Ever node a red/black tree is colored either red or black. datatpe a RBtree = O R of a * a RBtree * a RBtree B of a * a RBtree * a RBtree ; NB: Empt nodes are considered to be black. / 5 / 6 Red/Black tree sert We sist that ever red/black tree satisfies the followg two balance variants: 1. No red node has a red child. 2. Ever path from the root to an empt node contas the same number of black nodes. Together, these variants ensure that the longest possible path, one with alternatg black and red nodes, is no more than twice as long as the shortest possible path, one with black nodes onl. fun RBsert t = let fun s( O ) = R(, O, O ) (*1*) s( R(, l, r ) ) = if <= then R(, s l, r ) else R(, l, s r ) s( B(, l, r ) ) = if <= then BALANCE( B(, s l, r ) ) (*3*) else BALANCE( B(, l, s r ) ) ; (*3*) case s t of R(,l,r) => B(,l,r) (*2*) t => t / 7 / 8
3 This function etends the sert function for unbalanced search trees three significant was. 1. When we create a new node, we itiall color it red. 2. We force the fal root to be black, regardless of the color returned b s. 3. We clude calls to a BALANCE function, that massages its arguments as dicated the figure on the followg page to enforce the balance variants. NB: We allow a sgle red-red violation at a time, and percolate this violation up the search path towards the root durg rebalancg. t 4 t 2 t 3 t 4 t 3 t 2 t 2 t 3 t 4 t 2 t 2 t 3 t 4 / 9 t 3 t 4 / 10 fun BALANCE ( B(, R(, R(, t1, t2 ), t3 ), t4 ) B(, R(, t1, R(, t2, t3 ) ), t4 ) B(, t1, R(, t2, R(, t3, t4 ) ) ) B(, t1, R(, R(, t2, t3 ), t4) ) ) = R(, B(, t1, t2 ), B(, t3, t4 ) ) BALANCE t = t ; val BALANCE = fn : a RBtree -> a RBtree Functional arras A functional arra provides a mappg from an itial segment of natural numbers to elements, together with lookup and update operations. A fleible arra augments the above operations to sert or delete elements from either end of the arra. signature UpperFleARRAY = sig tpe a t eception Subscript val empt: a t val null: a t -> bool val length: a t -> t val lookup: a t * t -> a val update: a t * t * a -> a t val shrk: a t -> a t / 11 / 12
4 We will provide an implementation based on the followg tree-based data structure. structure TreeArraMod = struct abstpe a t = O V of a * a t * a t with eception Subscript ; val empt = O ; fun lookup( V(v,tl,tr), k ) = if k = 1 then v else if k mod 2 = 0 then lookup( tl, k div 2 ) else lookup( tr, k div 2 ) lookup( O, _ ) = raise Subscript ; fun update( O, k, v ) = if k = 1 then ( V(v,O,O), 1 ) else raise Subscript update( V(,tl,tr), k, v ) = if k = 1 then ( V(v,tl,tr), 0 ) else if k mod 2 = 0 then let val (t,i) = update(tl,k div 2,v) ( V(,t,tr), i ) end else let val (t,i) = update(tr,k div 2,v) ( V(,tl,t), i ) / 13 / 14 An implementation of upper fleible functional arras follows. fun delete( O, n ) = raise Subscript delete( V(v,tl,tr), n ) = if n = 1 then O else if n mod 2 = 0 then V( v, delete(tl,n div 2), tr ) else V( v, tl, delete(tr,n div 2) ) ; NB: The implementation can be etended to also provide downwards fleibilit logarithmic time. Consider this as an eercise, or consult [MLWP, 4.15]. structure TreeArra : UpperFleARRAY = struct abstpe a t = A of t * a TreeArraMod.t with eception Subscript ; val empt = A( 0, TreeArraMod.empt ) ; fun null( A(l,_) ) = l = 0 ; fun length( A(l,_) ) = l ; / 15 / 16
5 fun lookup( A(l,t), k ) = if l = 0 orelse ( k < 1 andalso k > l ) then raise Subscript else TreeArraMod.lookup(t,k) ; fun update( A(l,t), k, v ) = if 1 <= k andalso k <= l+1 then let val (u,i) = TreeArraMod.update( t, k, v ) A( l+i, u ) end else raise Subscript ; fun shrk( A(l,t) ) = if l = 0 then empt else A( l-1, TreeArraMod.delete(t,l) ) ; / 17 / 18 Priorit queues usg heaps A priorit queue is an ordered collection of items. Items ma be serted an order, but onl the highest priorit item (tpicall taken to be that with lower numerical value) ma be seen or deleted. signature PRIORITY_QUEUE = sig eception Sie tpe item tpe t val empt: t val null: t -> bool val sert: item -> t -> t val m: t -> item val delm: t -> t A heap is a bar tree which the labels are arranged so that ever label is less than or equal to all labels below it the tree. This heap condition puts the labels no strict order, but does put the least label at the root. The followg functional priorit queues are based on fleible arras that are heaps. structure Heap: PRIORITY_QUEUE = struct eception Sie ; tpe item = real ; abstpe a tree = O V of a * a tree * a tree with tpe t = item tree ; / 19 / 20
6 val empt = O ; fun null O = true null _ = false ; fun sert (w:item) O = V( w, O, O ) sert w ( V( v, l, r ) ) = if w <= v then V( w, sert v r, l ) else V( v, sert w r, l ) ; fun m( V(v,_,_) ) = v m O = raise Sie ; local eception Impossible ; fun leftrem( V( v, O, O ) ) = ( v, O ) leftrem( V( v, l, r ) ) = let val (w,t) = leftrem l ( w, V(v,r,t) ) end leftrem _ = raise Impossible ; / 21 / 22 fun siftdown( w:item, O, O ) = V( w, O, O ) siftdown( w, t as V(v,O,O), O ) = if w <= v then V( w, t, O ) else V( v, V(w,O,O), O ) siftdown( w, l as V(u,ll,lr), r as V(v,rl,rr) ) = if w <= u andalso w <= v then V(w,l,r) else if u <= v then V( u, siftdown(w,ll,lr),r) else V( v, l, siftdown(w,rl,rr) ) siftdown _ = raise Impossible ; fun delm O = raise Sie delm( V(v,O,_) ) = O delm( V(v,l,r) ) = let val (w,t) = leftrem l siftdown( w, r, t ) end / 23 / 24
7 Heap sort fun heaptolist h = if Heap.null h then [] else (Heap.m h) :: heaptolist(heap.delm h) ; val sort = heaptolist o foldl (fn(v,h) => Heap.sert v h) Heap.empt ; / 25
A Simple Implementation Technique for Priority Search Queues
A Simple Implementation Technique for Priority Search Queues RALF HINZE Institute of Information and Computing Sciences Utrecht University Email: ralf@cs.uu.nl Homepage: http://www.cs.uu.nl/~ralf/ April,
More informationChapter 6. Self-Adjusting Data Structures
Chapter 6 Self-Adjusting Data Structures Chapter 5 describes a data structure that is able to achieve an epected quer time that is proportional to the entrop of the quer distribution. The most interesting
More informationDictionary: an abstract data type
2-3 Trees 1 Dictionary: an abstract data type A container that maps keys to values Dictionary operations Insert Search Delete Several possible implementations Balanced search trees Hash tables 2 2-3 trees
More informationDictionary: an abstract data type
2-3 Trees 1 Dictionary: an abstract data type A container that maps keys to values Dictionary operations Insert Search Delete Several possible implementations Balanced search trees Hash tables 2 2-3 trees
More informationFunctional Data Structures
Functional Data Structures with Isabelle/HOL Tobias Nipkow Fakultät für Informatik Technische Universität München 2017-2-3 1 Part II Functional Data Structures 2 Chapter 1 Binary Trees 3 1 Binary Trees
More informationInterface for module Ptset
Interface for module Ptset 1 1 Interface for module Ptset 1. Sets of tegers implemented as Patricia trees. The followg signature is exactly Set.S with type elt = t, with the same specifications. This is
More informationPriority queues implemented via heaps
Priority queues implemented via heaps Comp Sci 1575 Data s Outline 1 2 3 Outline 1 2 3 Priority queue: most important first Recall: queue is FIFO A normal queue data structure will not implement a priority
More informationChapter 5 Data Structures Algorithm Theory WS 2017/18 Fabian Kuhn
Chapter 5 Data Structures Algorithm Theory WS 2017/18 Fabian Kuhn Priority Queue / Heap Stores (key,data) pairs (like dictionary) But, different set of operations: Initialize-Heap: creates new empty heap
More informationSearch Trees. Chapter 10. CSE 2011 Prof. J. Elder Last Updated: :52 AM
Search Trees Chapter 1 < 6 2 > 1 4 = 8 9-1 - Outline Ø Binary Search Trees Ø AVL Trees Ø Splay Trees - 2 - Outline Ø Binary Search Trees Ø AVL Trees Ø Splay Trees - 3 - Binary Search Trees Ø A binary search
More informationApproximation: Theory and Algorithms
Approimation: Theor and Algorithms Edit Distance Compleit, Upper and Lower Bounds Nikolaus Augsten Free Universit of Bozen-Bolzano Facult of Computer Science DIS Unit 8 April, 009 Nikolaus Augsten (DIS)
More informationMathematics of Cryptography Part I
CHAPTER 2 Mathematics of Crptograph Part I (Solution to Practice Set) Review Questions 1. The set of integers is Z. It contains all integral numbers from negative infinit to positive infinit. The set of
More informationGraphing Inequalities
10 Graphg Inequalities In this chapter, ou will practice graphg equalities that have one or two variables. When there is onl one variable, ou use a number le. When there are two variables, ou use a coordate
More informationENS Lyon Camp. Day 2. Basic group. Cartesian Tree. 26 October
ENS Lyon Camp. Day 2. Basic group. Cartesian Tree. 26 October Contents 1 Cartesian Tree. Definition. 1 2 Cartesian Tree. Construction 1 3 Cartesian Tree. Operations. 2 3.1 Split............................................
More informationCS213d Data Structures and Algorithms
CS21d Data Structures and Algorithms Heaps and their Applications Milind Sohoni IIT Bombay and IIT Dharwad March 22, 2017 1 / 18 What did I see today? March 22, 2017 2 / 18 Heap-Trees A tree T of height
More informationData Structures and Algorithms " Search Trees!!
Data Structures and Algorithms " Search Trees!! Outline" Binary Search Trees! AVL Trees! (2,4) Trees! 2 Binary Search Trees! "! < 6 2 > 1 4 = 8 9 Ordered Dictionaries" Keys are assumed to come from a total
More informationCSE 5311 Notes 5: Trees. (Last updated 6/4/13 4:12 PM)
SE 511 Notes 5: Trees (Last updated 6//1 :1 PM) What is the optimal wa to organie a static tree for searching? n optimal (static) binar search tree is significantl more complicated to construct than an
More informationBinary Search Trees. Motivation
Binary Search Trees Motivation Searching for a particular record in an unordered list takes O(n), too slow for large lists (databases) If the list is ordered, can use an array implementation and use binary
More informationINF2220: algorithms and data structures Series 1
Universitetet i Oslo Institutt for Informatikk I. Yu, D. Karabeg INF2220: algorithms and data structures Series 1 Topic Function growth & estimation of running time, trees (Exercises with hints for solution)
More informationCS Data Structures and Algorithm Analysis
CS 483 - Data Structures and Algorithm Analysis Lecture VII: Chapter 6, part 2 R. Paul Wiegand George Mason University, Department of Computer Science March 22, 2006 Outline 1 Balanced Trees 2 Heaps &
More informationOutline. A recursive function follows the structure of inductively-defined data.
Outline A recursive function follows the structure of inductively-defined data. With lists as our example, we shall study 1. inductive definitions (to specify data) 2. recursive functions (to process data)
More informationCS 240 Data Structures and Data Management. Module 4: Dictionaries
CS 24 Data Structures and Data Management Module 4: Dictionaries A. Biniaz A. Jamshidpey É. Schost Based on lecture notes by many previous cs24 instructors David R. Cheriton School of Computer Science,
More informationUniversity of New Mexico Department of Computer Science. Midterm Examination. CS 361 Data Structures and Algorithms Spring, 2003
University of New Mexico Department of Computer Science Midterm Examination CS 361 Data Structures and Algorithms Spring, 2003 Name: Email: Print your name and email, neatly in the space provided above;
More informationSearch Trees. EECS 2011 Prof. J. Elder Last Updated: 24 March 2015
Search Trees < 6 2 > 1 4 = 8 9-1 - Outline Ø Binary Search Trees Ø AVL Trees Ø Splay Trees - 2 - Learning Outcomes Ø From this lecture, you should be able to: q Define the properties of a binary search
More information/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: Dynamic Programming II Date: 10/12/17
601.433/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: Dynamic Programming II Date: 10/12/17 12.1 Introduction Today we re going to do a couple more examples of dynamic programming. While
More informationCircle your instructor s last name
ME 00 Thermodynamics Fall 07 Exam Circle your structor s last name Division : Naik Division : Wassgren Division 6: Braun Division : Sojka Division 4: Goldenste Division 7: Buckius Division 8: Meyer INSTRUCTIONS
More informationCS361 Homework #3 Solutions
CS6 Homework # Solutions. Suppose I have a hash table with 5 locations. I would like to know how many items I can store in it before it becomes fairly likely that I have a collision, i.e., that two items
More information8 Priority Queues. 8 Priority Queues. Prim s Minimum Spanning Tree Algorithm. Dijkstra s Shortest Path Algorithm
8 Priority Queues 8 Priority Queues A Priority Queue S is a dynamic set data structure that supports the following operations: S. build(x 1,..., x n ): Creates a data-structure that contains just the elements
More informationCSE 202: Design and Analysis of Algorithms Lecture 3
CSE 202: Design and Analysis of Algorithms Lecture 3 Instructor: Kamalika Chaudhuri Announcement Homework 1 out Due on Tue Jan 24 in class No late homeworks will be accepted Greedy Algorithms Direct argument
More informationRegister machines L2 18
Register machines L2 18 Algorithms, informally L2 19 No precise definition of algorithm at the time Hilbert posed the Entscheidungsproblem, just examples. Common features of the examples: finite description
More informationDiscrete Wiskunde II. Lecture 5: Shortest Paths & Spanning Trees
, 2009 Lecture 5: Shortest Paths & Spanning Trees University of Twente m.uetz@utwente.nl wwwhome.math.utwente.nl/~uetzm/dw/ Shortest Path Problem "#$%&'%()*%"()$#+,&- Given directed "#$%&'()*+,%+('-*.#/'01234564'.*,'7+"-%/8',&'5"4'84%#3
More informationAVL Trees. Manolis Koubarakis. Data Structures and Programming Techniques
AVL Trees Manolis Koubarakis 1 AVL Trees We will now introduce AVL trees that have the property that they are kept almost balanced but not completely balanced. In this way we have O(log n) search time
More information1 Greedy Graph Algorithms
+//+ Algorithms & Data Structures (DL) Exam of 7 December 5 Instructions: This is a multiple-choice exam, to save ou the time of tiding up the presentation of our answers. There is exactl one correct answer
More informationCS60007 Algorithm Design and Analysis 2018 Assignment 1
CS60007 Algorithm Design and Analysis 2018 Assignment 1 Palash Dey and Swagato Sanyal Indian Institute of Technology, Kharagpur Please submit the solutions of the problems 6, 11, 12 and 13 (written in
More information3.2 LOGARITHMIC FUNCTIONS AND THEIR GRAPHS
Section. Logarithmic Functions and Their Graphs 7. LOGARITHMIC FUNCTIONS AND THEIR GRAPHS Ariel Skelle/Corbis What ou should learn Recognize and evaluate logarithmic functions with base a. Graph logarithmic
More informationExploring the Logarithmic Function (PROVING IDENTITIES QUIZ) Transformations of the Logarithmic Function Pg. 457 # 1 4, 7, 9
UNIT 7 EXPONENTIAL AND LOGARITHMIC FUNCTIONS Date Lesson Text TOPIC Homework Dec. 5 7. 8. Exploring the Logarithmic Function (PROVING IDENTITIES QUIZ) Pg. 5 # 6 Dec. 6 7. 8. Transformations of the Logarithmic
More informationMaximum Flow Problem (Ford and Fulkerson, 1956)
Maximum Flow Problem (Ford and Fulkerson, 196) In this problem we find the maximum flow possible in a directed connected network with arc capacities. There is unlimited quantity available in the given
More informationAdvanced Implementations of Tables: Balanced Search Trees and Hashing
Advanced Implementations of Tables: Balanced Search Trees and Hashing Balanced Search Trees Binary search tree operations such as insert, delete, retrieve, etc. depend on the length of the path to the
More informationPremaster Course Algorithms 1 Chapter 3: Elementary Data Structures
Premaster Course Algorithms 1 Chapter 3: Elementary Data Structures Christian Scheideler SS 2018 23.04.2018 Chapter 3 1 Overview Basic data structures Search structures (successor searching) Dictionaries
More informationProblem. Problem Given a dictionary and a word. Which page (if any) contains the given word? 3 / 26
Binary Search Introduction Problem Problem Given a dictionary and a word. Which page (if any) contains the given word? 3 / 26 Strategy 1: Random Search Randomly select a page until the page containing
More informationQuiz 1 Solutions. Problem 2. Asymptotics & Recurrences [20 points] (3 parts)
Introduction to Algorithms October 13, 2010 Massachusetts Institute of Technology 6.006 Fall 2010 Professors Konstantinos Daskalakis and Patrick Jaillet Quiz 1 Solutions Quiz 1 Solutions Problem 1. We
More informationDynamic Programming: Shortest Paths and DFA to Reg Exps
CS 374: Algorithms & Models of Computation, Fall 205 Dynamic Programming: Shortest Paths and DFA to Reg Exps Lecture 7 October 22, 205 Chandra & Manoj (UIUC) CS374 Fall 205 / 54 Part I Shortest Paths with
More information4.8 Huffman Codes. These lecture slides are supplied by Mathijs de Weerd
4.8 Huffman Codes These lecture slides are supplied by Mathijs de Weerd Data Compression Q. Given a text that uses 32 symbols (26 different letters, space, and some punctuation characters), how can we
More informationCS 151. Red Black Trees & Structural Induction. Thursday, November 1, 12
CS 151 Red Black Trees & Structural Induction 1 Announcements Majors fair tonight 4:30-6:30pm in the Root Room in Carnegie. Come and find out about the CS major, or some other major. Winter Term in CS
More informationDynamic Programming: Shortest Paths and DFA to Reg Exps
CS 374: Algorithms & Models of Computation, Spring 207 Dynamic Programming: Shortest Paths and DFA to Reg Exps Lecture 8 March 28, 207 Chandra Chekuri (UIUC) CS374 Spring 207 / 56 Part I Shortest Paths
More informationRecitation 7. Treaps and Combining BSTs. 7.1 Announcements. FingerLab is due Friday afternoon. It s worth 125 points.
Recitation 7 Treaps and Combining BSTs 7. Announcements FingerLab is due Friday afternoon. It s worth 25 points. RangeLab will be released on Friday. 39 40 RECITATION 7. TREAPS AND COMBINING BSTS 7.2 Deletion
More informationSecond-Order Linear Differential Equations C 2
C8 APPENDIX C Additional Topics in Differential Equations APPENDIX C. Second-Order Homogeneous Linear Equations Second-Order Linear Differential Equations Higher-Order Linear Differential Equations Application
More informationCSE548, AMS542: Analysis of Algorithms, Fall 2017 Date: Oct 26. Homework #2. ( Due: Nov 8 )
CSE548, AMS542: Analysis of Algorithms, Fall 2017 Date: Oct 26 Homework #2 ( Due: Nov 8 ) Task 1. [ 80 Points ] Average Case Analysis of Median-of-3 Quicksort Consider the median-of-3 quicksort algorithm
More informationNearest Neighbor Search with Keywords
Nearest Neighbor Search with Keywords Yufei Tao KAIST June 3, 2013 In recent years, many search engines have started to support queries that combine keyword search with geography-related predicates (e.g.,
More informationCSE 202 Homework 4 Matthias Springer, A
CSE 202 Homework 4 Matthias Springer, A99500782 1 Problem 2 Basic Idea PERFECT ASSEMBLY N P: a permutation P of s i S is a certificate that can be checked in polynomial time by ensuring that P = S, and
More informationDivide-and-Conquer Algorithms Part Two
Divide-and-Conquer Algorithms Part Two Recap from Last Time Divide-and-Conquer Algorithms A divide-and-conquer algorithm is one that works as follows: (Divide) Split the input apart into multiple smaller
More informationHamiltonicity and Fault Tolerance
Hamiltonicit and Fault Tolerance in the k-ar n-cube B Clifford R. Haithcock Portland State Universit Department of Mathematics and Statistics 006 In partial fulfillment of the requirements of the degree
More informationCS 4407 Algorithms Lecture: Shortest Path Algorithms
CS 440 Algorithms Lecture: Shortest Path Algorithms Prof. Gregory Provan Department of Computer Science University College Cork 1 Outline Shortest Path Problem General Lemmas and Theorems. Algorithms Bellman-Ford
More informationQuiz 1 Solutions. (a) f 1 (n) = 8 n, f 2 (n) = , f 3 (n) = ( 3) lg n. f 2 (n), f 1 (n), f 3 (n) Solution: (b)
Introduction to Algorithms October 14, 2009 Massachusetts Institute of Technology 6.006 Spring 2009 Professors Srini Devadas and Constantinos (Costis) Daskalakis Quiz 1 Solutions Quiz 1 Solutions Problem
More informationLimits 4: Continuity
Limits 4: Continuit 55 Limits 4: Continuit Model : Continuit I. II. III. IV. z V. VI. z a VII. VIII. IX. Construct Your Understanding Questions (to do in class). Which is the correct value of f (a) in
More informationAssignment 5: Solutions
Comp 21: Algorithms and Data Structures Assignment : Solutions 1. Heaps. (a) First we remove the minimum key 1 (which we know is located at the root of the heap). We then replace it by the key in the position
More informationCS 410/584, Algorithm Design & Analysis, Lecture Notes 4
CS 0/58,, Biconnectivity Let G = (N,E) be a connected A node a N is an articulation point if there are v and w different from a such that every path from 0 9 8 3 5 7 6 David Maier Biconnected Component
More informationCuckoo Hashing and Cuckoo Filters
Cuckoo Hashing and Cuckoo Filters Noah Fleming May 7, 208 Preliminaries A dictionary is an abstract data type that stores a collection of elements, located by their key. It supports operations: insert,
More informationEach internal node v with d(v) children stores d 1 keys. k i 1 < key in i-th sub-tree k i, where we use k 0 = and k d =.
7.5 (a, b)-trees 7.5 (a, b)-trees Definition For b a an (a, b)-tree is a search tree with the following properties. all leaves have the same distance to the root. every internal non-root vertex v has at
More informationFundamental Algorithms
Fundamental Algorithms Chapter 5: Searching Michael Bader Winter 2014/15 Chapter 5: Searching, Winter 2014/15 1 Searching Definition (Search Problem) Input: a sequence or set A of n elements (objects)
More informationFirst Order Predicate Logic (FOL) Formulas
1 First Order Predicate Logic (FOL) Formulas Let Σ = (S, Ω) be a signature. P L(Σ) is the smallest set with (i) t = u P L(Σ), (ii) (iii) (iv) if X set of variables for Σ, s S, t, u T Σ(X),s (ϕ 1 ϕ 2 )
More informationIS 709/809: Computational Methods in IS Research Fall Exam Review
IS 709/809: Computational Methods in IS Research Fall 2017 Exam Review Nirmalya Roy Department of Information Systems University of Maryland Baltimore County www.umbc.edu Exam When: Tuesday (11/28) 7:10pm
More informationPin-Permutations: Characterization and Generating Function. Frédérique Bassino Mathilde Bouvel Dominique Rossin
: Characterization and Generating Function Frédérique Bassino Dominique Rossin Journées Permutations et Combinatoire, Projet ANR GAMMA, Nov. 2008 liafa Main result of the talk Conjecture[Brignall, Ruškuc,
More informationDesign and Analysis of Algorithms
CSE 0, Winter 208 Design and Analsis of Algorithms Lecture 6: NP-Completeness, Part 2 Class URL: http://vlsicad.ucsd.edu/courses/cse0-w8/ The Classes P and NP Classes of Decision Problems P: Problems for
More informationEcient and improved implementations of this method were, for instance, given in [], [7], [9] and [0]. These implementations contain more and more ecie
Triangular Heaps Henk J.M. Goeman Walter A. Kosters Department of Mathematics and Computer Science, Leiden University, P.O. Box 95, 300 RA Leiden, The Netherlands Email: fgoeman,kostersg@wi.leidenuniv.nl
More informationBinary Search Trees. Lecture 29 Section Robb T. Koether. Hampden-Sydney College. Fri, Apr 8, 2016
Binary Search Trees Lecture 29 Section 19.2 Robb T. Koether Hampden-Sydney College Fri, Apr 8, 2016 Robb T. Koether (Hampden-Sydney College) Binary Search Trees Fri, Apr 8, 2016 1 / 40 1 Binary Search
More informationStructure. Background. them to their higher order equivalents. functionals in Standard ML source code and converts
Introduction 3 Background functionals factor out common behaviour map applies a function to every element of a list fun map [ ] = [ ] map f ( x : : xs ) = f x : : map f xs filter keeps only those elements
More informationFast String Kernels. Alexander J. Smola Machine Learning Group, RSISE The Australian National University Canberra, ACT 0200
Fast String Kernels Alexander J. Smola Machine Learning Group, RSISE The Australian National University Canberra, ACT 0200 Alex.Smola@anu.edu.au joint work with S.V.N. Vishwanathan Slides (soon) available
More informationAVL trees. AVL trees
Dnamic set DT dnamic set DT is a structure tat stores a set of elements. Eac element as a (unique) ke and satellite data. Te structure supports te following operations. Searc(S, k) Return te element wose
More informationAlgorithms Theory. 08 Fibonacci Heaps
Algorithms Theory 08 Fibonacci Heaps Prof. Dr. S. Albers Priority queues: operations Priority queue Q Operations: Q.initialize(): initializes an empty queue Q Q.isEmpty(): returns true iff Q is empty Q.insert(e):
More informationDenotational Semantics of Programs. : SimpleExp N.
Models of Computation, 2010 1 Denotational Semantics of Programs Denotational Semantics of SimpleExp We will define the denotational semantics of simple expressions using a function : SimpleExp N. Denotational
More informationFall Lecture 5
15-150 Fall 2018 Lecture 5 Today Work sequential runtime Recurrences exact and approximate solutions Improving efficiency program recurrence work asymptotic Want the runtime of evaluating f(n), for large
More informationNumber of extra papers used if any
Last Name: First Name: Thermo no. ME 200 Thermodynamics 1 Fall 2018 Exam Circle your structor s last name Division 1 (7:0): Naik Division (1:0): Wassgren Division 6 (11:0): Sojka Division 2 (9:0): Choi
More informationIntroduction to (Logic and Functional) Programming
Introduction to (Logic and Functional) Programming http://www.cse.iitd.ac.in/ sak/courses/ilfp/2011-12.index.html S. Arun-Kumar Department of Computer Science and Engineering I. I. T. Delhi, Hauz Khas,
More information16. Binary Search Trees. [Ottman/Widmayer, Kap. 5.1, Cormen et al, Kap ]
418 16. Binary Search Trees [Ottman/Widmayer, Kap. 5.1, Cormen et al, Kap. 12.1-12.3] 419 Dictionary implementation Hashing: implementation of dictionaries with expected very fast access times. Disadvantages
More informationCSE613: Parallel Programming, Spring 2012 Date: May 11. Final Exam. ( 11:15 AM 1:45 PM : 150 Minutes )
CSE613: Parallel Programming, Spring 2012 Date: May 11 Final Exam ( 11:15 AM 1:45 PM : 150 Minutes ) This exam will account for either 10% or 20% of your overall grade depending on your relative performance
More informationFibonacci Heaps These lecture slides are adapted from CLRS, Chapter 20.
Fibonacci Heaps These lecture slides are adapted from CLRS, Chapter 20. Princeton University COS 4 Theory of Algorithms Spring 2002 Kevin Wayne Priority Queues Operation mae-heap insert find- delete- union
More informationSolutions. Prelim 2[Solutions]
Prelim [Solutions]. Short Answer [ pts] (a) [ pts] A traversal of an expression tree produces the string + + 3. i. What kind of traversal is it? Preorder; the operator is printed before the operands. ii.
More informationText Compression. Jayadev Misra The University of Texas at Austin December 5, A Very Incomplete Introduction to Information Theory 2
Text Compression Jayadev Misra The University of Texas at Austin December 5, 2003 Contents 1 Introduction 1 2 A Very Incomplete Introduction to Information Theory 2 3 Huffman Coding 5 3.1 Uniquely Decodable
More information16. Binary Search Trees. [Ottman/Widmayer, Kap. 5.1, Cormen et al, Kap ]
423 16. Binary Search Trees [Ottman/Widmayer, Kap. 5.1, Cormen et al, Kap. 12.1-12.3] Dictionary implementation 424 Hashing: implementation of dictionaries with expected very fast access times. Disadvantages
More informationSTUDY KNOWHOW PROGRAM STUDY AND LEARNING CENTRE. Functions & Graphs
STUDY KNOWHOW PROGRAM STUDY AND LEARNING CENTRE Functions & Graphs Contents Functions and Relations... 1 Interval Notation... 3 Graphs: Linear Functions... 5 Lines and Gradients... 7 Graphs: Quadratic
More informationLarge-scale Linear RankSVM
Large-scale Linear RankSVM Ching-Pei Lee Department of Computer Science National Taiwan University Joint work with Chih-Jen Lin Ching-Pei Lee (National Taiwan Univ.) 1 / 41 Outline 1 Introduction 2 Our
More information4 The Cartesian Coordinate System- Pictures of Equations
The Cartesian Coordinate Sstem- Pictures of Equations Concepts: The Cartesian Coordinate Sstem Graphs of Equations in Two Variables -intercepts and -intercepts Distance in Two Dimensions and the Pthagorean
More informationA Functional Perspective
A Functional Perspective on SSA Optimization Algorithms Patryk Zadarnowski jotly with Manuel M. T. Chakravarty Gabriele Keller 19 April 2004 University of New South Wales Sydney THE PLAN ➀ Motivation an
More informationMA Game Theory 2005, LSE
MA. Game Theor, LSE Problem Set The problems in our third and final homework will serve two purposes. First, the will give ou practice in studing games with incomplete information. Second (unless indicated
More informationFault-Tolerant Consensus
Fault-Tolerant Consensus CS556 - Panagiota Fatourou 1 Assumptions Consensus Denote by f the maximum number of processes that may fail. We call the system f-resilient Description of the Problem Each process
More information2-INF-237 Vybrané partie z dátových štruktúr 2-INF-237 Selected Topics in Data Structures
2-INF-237 Vybrané partie z dátových štruktúr 2-INF-237 Selected Topics in Data Structures Instructor: Broňa Brejová E-mail: brejova@fmph.uniba.sk Office: M163 Course webpage: http://compbio.fmph.uniba.sk/vyuka/vpds/
More informationPartha Sarathi Mandal
MA 252: Data Structures and Algorithms Lecture 32 http://www.iitg.ernet.in/psm/indexing_ma252/y12/index.html Partha Sarathi Mandal Dept. of Mathematics, IIT Guwahati The All-Pairs Shortest Paths Problem
More informationConic Section: Circles
Conic Section: Circles Circle, Center, Radius A circle is defined as the set of all points that are the same distance awa from a specific point called the center of the circle. Note that the circle consists
More informationChapter 4. Greedy Algorithms. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.
Chapter 4 Greedy Algorithms Slides by Kevin Wayne. Copyright Pearson-Addison Wesley. All rights reserved. 4 4.1 Interval Scheduling Interval Scheduling Interval scheduling. Job j starts at s j and finishes
More informationsearching algorithms
searching algorithms learning objectives algorithms your software system software hardware learn what the searching problem is about learn two algorithms for solving this problem learn the importance of
More informationSplay Trees. CMSC 420: Lecture 8
Splay Trees CMSC 420: Lecture 8 AVL Trees Nice Features: - Worst case O(log n) performance guarantee - Fairly simple to implement Problem though: - Have to maintain etra balance factor storage at each
More informationLESSON #48 - INTEGER EXPONENTS COMMON CORE ALGEBRA II
LESSON #8 - INTEGER EXPONENTS COMMON CORE ALGEBRA II We just finished our review of linear functions. Linear functions are those that grow b equal differences for equal intervals. In this unit we will
More informationINEQUALITIES
Chapter 4 INEQUALITIES 4.2.1 4.2.4 Once the students understand the notion of a solution, the can etend their understanding to inequalities and sstems of inequalities. Inequalities tpicall have infinitel
More informationRoger Johnson Structure and Dynamics: The 230 space groups Lecture 3
Roger Johnson Structure and Dnamics: The 23 space groups Lecture 3 3.1. Summar In the first two lectures we considered the structure and dnamics of single molecules. In this lecture we turn our attention
More informationLecture 7: Dynamic Programming I: Optimal BSTs
5-750: Graduate Algorithms February, 06 Lecture 7: Dynamic Programming I: Optimal BSTs Lecturer: David Witmer Scribes: Ellango Jothimurugesan, Ziqiang Feng Overview The basic idea of dynamic programming
More informationAlgorithms, Probability and Computing HS2010 1
Algorithms, Probability and Computing HS2010 1 Stefan Heule February 8, 2011 1 License: Creative Commons Attribution-Share Alike 3.0 Unported (http://creativecommons.org/licenses/ by-sa/3.0/) Contents
More informationSF2972 Game Theory Problem set on extensive form games
SF2972 Game Theor Problem set on etensive form games Mark Voorneveld There are five eercises, to be handed in at the final lecture (March 0). For a bonus point, please answer all questions; at least half
More informationPrelim 2[Solutions] Solutions. 1. Short Answer [18 pts]
Prelim [Solutions]. Short Answer [8 pts] (a) [3 pts] In a model/view/controller, Swing is likely to be part of (there may be more than one): i. the model ii. the view iii. the controller The view and the
More information8: Splay Trees. Move-to-Front Heuristic. Splaying. Splay(12) CSE326 Spring April 16, Search for Pebbles: Move found item to front of list
: Splay Trees SE Spring 00 pril, 00 Move-to-Front Heuristic Search for ebbles: Fred Wilma ebbles ino Fred Wilma ino ebbles Move found item to front of list Frequently searched items will move to start
More informationSIGNAL COMPRESSION Lecture 7. Variable to Fix Encoding
SIGNAL COMPRESSION Lecture 7 Variable to Fix Encoding 1. Tunstall codes 2. Petry codes 3. Generalized Tunstall codes for Markov sources (a presentation of the paper by I. Tabus, G. Korodi, J. Rissanen.
More information