B- TREE. Michael Tsai 2017/06/06
|
|
- Ami Dean
- 5 years ago
- Views:
Transcription
1 B- TREE Michael Tsai 2017/06/06
2 2 B- Tree Overview Balanced search tree Very large branching factor Height = O(log n), but much less than that of RB tree Usage: Large amount of data to be stored - - Partially in memory, and partially in secondary storage (e.g., hard drive) Goal: 1. Minimizing disk I/O operation 2. Minimizing CPU time
3 3 Typical Storage Speed / Capacity Storage Read speed Capacity Hard Drive Typically ~100 MB/s Up to 10 TB SSD ~500 MB/s Up to 1 TB SD Memory 30 MB/s (UHS- 3) 10 MB/s (class 10) 6400 MB/s (DDR3) Up to 1 TB (Typically 32 GB or 64 GB) Desktop/laptop has 4~16 GB
4 4 Typical B- Tree (keys) T:root M Internal node x has x.n keys (3) D H Q T X B C F G J K L Keys in x separate the ranges of keys in its sub trees. N P R S V W Y Z Internal node x has x.n+1 children (4)
5 5 Typical B- Tree (search) T:root R M Internal node x has x.n keys (3) D H Q T X B C F G J K L Keys in x separate the ranges of keys in its sub trees. N P R S V W Y Z Internal node x has x.n+1 children (4)
6 6 A more realistic B- tree T:root Usually only a node s keys/data is read from the disk at a time. Root is always kept in the memory.
7 7 B- Tree Definition (1) B- Tree is a rooted tree For each node x: x.n is the number of keys in x Keys: x.key 1,x.key 2,...,x.key x.n are stored in non- decreasingorder. x.key 1 apple x.key 2 apple apple x.key x.n x.leaf, TRUE if x is a leaf and FALSE otherwise. Each internal node x contains x.n+1 pointers x.c 1,x.c 2,...,x.c x.n+1 Leaves have these undefined.
8 8 B- Tree Definitions (2) The keys x.key i separate the ranges of keys stored in each subtree: is any key stored in the subtree with root, k i All leaves have the same depth: the tree s height h. Minimum degree of B- tree: x.c i k 1 apple x.key 1 apple k 2 apple x.key 2 apple apple x.key x.n apple k x.n+1 t 2 Every node other than root have at least t- 1 keys (thus t children) Every node can have at most 2t- 1 keys (thus 2t children) (In this case, this node is full)
9 9 Proof: B- Tree Height If n 1, then for any n- key B- tree T of height h and minimum degree, t 2 h apple log t n +1 2 Proof: Consider the case with each node node t 1 T:root 1 having the least # of t 1 depth 1 number of nodes t 1 t t 1 t 1 t t 1 2 2t t t 1 t 1 t t 1 t 1 t t 1 t 1 t t 1 t 1 3 2t 2
10 10 Proof: B- Tree Height n 1+(t 1) = 1 + 2(t 1) =2t h 1 hx i=1 2t i 1 t h 1 t 1 t h apple (n + 1)/2 )h apple log t (n + 1) 2 h = O(log n)
11 11 Disk Operation DISK- READ(x) : if x is not in memory, then we require this before accessing x. no- op if x is already in the memory. DISK- WRITE(x): this is required for putting any changes of x back to the disk. Root is always stored in the memory Typical work flow: x = pointer to an object DISK-READ(x) (operations to modify x) DISK-WRITE(x) Operations to access x (but no modifications)
12 12 Search in B- Tree B-TREE-SEARCH.x; k/ 1 i D 1 2 while i x:n and k>x:key i 3 i D i C 1 4 if i x:n and k == x:key i 5 return.x; i/ 6 elseif x:leaf 7 return NIL 8 else DISK-READ.x:c i / 9 return B-TREE-SEARCH.x:c i ;k/ Input: x: search from this node k: key to be searched Return value: (x,i): key k is found at node x s i- th key CPU time: Disk I/O: O(t log t n) O(log t n) Using a linear-search procedure, lines 1 3 fi,orelsetheyset to. L
13 13 Create an empty B- Tree on the disk for that node. B-TREE-CREATE.T / 1 x D ALLOCATE-NODE./ 2 x:leaf D TRUE 3 x:n D 0 4 DISK-WRITE.x/ 5 T:root D x Allocate- Node() is a O(1) operation to allocate a disk page to store a new node CPU time: O(1) Disk I/O: O(1) B-TREE-CREATE requires
14 14 B- Tree Insertion: Overview Cannot simply create a new leaf node and insert it: this will violate the B- tree definitions Sol: insert into an existing leaf node Problem: what if that leaf node is already FULL? FULL: having 2t- 1 keys and 2t children Sol: split a full node y around its median key y.key t y.key 1,y.key 2,...,y.key t 1,<y.key t <y.key t+1,y.key t+2,...,y.key 2t 1, t keys smaller than median t keys larger than median y.key t Then move up to y s parent node. What if y s parent is also full? We split it too Workflow: Start from root (search), split all traversed full nodes
15 15 B- Tree Insertion: Overview x N W y D x:c ix:keyi 1 x:key i P Q R S T U V x y D x:c i N S W x:key i 1 x:key i x:key ic1 D x:c ic1 P Q R T U V T 1 T 2 T 3 T 4 T 5 T 6 T 7 T 8 T 1 T 2 T 3 T 4 T 5 T 6 T 7 T 8 t=4 2t- 1=7
16 16 B- Tree: Split Full Child B-TREE-SPLIT-CHILD.x; i/ 1 D ALLOCATE-NODE./ 2 y D x:c i 3 :leaf D y:leaf 4 :n D t 1 5 for j D 1 to t 1 6 :key j D y:key j Ct 7 if not y:leaf 8 for j D 1 to t 9 :c j D y:c j Ct 10 y:n D t 1 11 for j D x:n C 1 downto i C 1 12 x:c j C1 D x:c j 13 x:c C D 14 for n downto Split node x s i- th child, which is full CPU time: O(t) Disk I/O: O(1) D C C 12 j C1 D j 13 x:c ic1 D 14 for j D x:n downto i 15 x:key j C1 D x:key j 16 x:key i D y:key t 17 x:n D x:n C 1 18 DISK-WRITE.y/ 19 DISK-WRITE. / 20 DISK-WRITE.x/
17 17 B- Tree: Split the Root T:root r A D F H L N P T 1 T 2 T 3 T 4 T 5 T 6 T 7 T 8 T:root s H r A D F L N P T 1 T 2 T 3 T 4 T 5 T 6 T 7 T 8 Splitting the root is the only way to increase the height of a B- tree Height is increased at the top, not at the bottom
18 18 B- Tree: Split the Root cursion Please never review descends the pseudo to a full code node. below yourself. B-TREE-INSERT.T; k/ 1 r D T:root 2 if r:n == 2t 1 3 s D ALLOCATE-NODE./ 4 T:root D s 5 s:leaf D FALSE 6 s:n D 0 7 s:c 1 D r 8 B-TREE-SPLIT-CHILD.s; 1/ 9 B-TREE-INSERT-NONFULL.s; k/ 10 else B-TREE-INSERT-NONFULL.r; k/ Lines 3 9 handle the case in which the root n
19 Insertion Example 19
20 20 B- Tree Insertion:pseudo code B-TREE-INSERT-NONFULL.x; k/ 1 i D x:n 2 if x:leaf 3 while i 1 and k<x:key i 4 x:key ic1 D x:key i 5 i D i 1 6 x:key ic1 D k 7 x:n D x:n C 1 8 DISK-WRITE.x/ 9 else while i 1 and k<x:key i 10 i D i 1 11 i D i C 1 12 DISK-READ.x:c i / 13 if x:c i :n == 2t 1 14 B-TREE-SPLIT-CHILD.x; i/ 15 if k>x:key i 16 i D i C 1 17 B-TREE-INSERT-NONFULL.x:c i ;k/ The B-TREE-INSERT-NONFULL procedure wo If x is a leaf, insert k at the right location If x is not a leaf, then.. Find the right child node If the child node is full, first split it! (its median key will come back to this node) Finally, recursive call to continue to the child node
21 21 B- Tree Insertion: running time cursion never descends to a full node. B-TREE-INSERT.T; k/ 1 r D T:root 2 if r:n == 2t 1 3 s D ALLOCATE-NODE./ 4 T:root D s 5 s:leaf D FALSE 6 s:n D 0 7 s:c 1 D r 8 B-TREE-SPLIT-CHILD.s; 1/ 9 B-TREE-INSERT-NONFULL.s; k/ 10 else B-TREE-INSERT-NONFULL.r; k/ Lines 3 9 handle the case in which the root n CPU time: Disk I/O: O(t log t n) O(log t n) B-TREE-INSERT-NONFULL.x; k/ 1 i D x:n 2 if x:leaf 3 while i 1 and k<x:key i 4 x:key ic1 D x:key i 5 i D i 1 6 x:key ic1 D k 7 x:n D x:n C 1 8 DISK-WRITE.x/ 9 else while i 1 and k<x:key i 10 i D i 1 11 i D i C 1 12 DISK-READ.x:c i / 13 if x:c i :n == 2t 1 14 B-TREE-SPLIT-CHILD.x; i/ 15 if k>x:key i 16 i D i C 1 17 B-TREE-INSERT-NONFULL.x:c i ;k/ The B-TREE-INSERT-NONFULL procedure wo
22 22 Reading Assignment (Real) Chapter 18.3 Deleting a key from a B- tree
searching 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 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 informationData Structures and and Algorithm Xiaoqing Zheng
Data Structures and Algorithm Xiaoqing Zheng zhengxq@fudan.edu.cn Trees (max heap) 1 16 2 3 14 10 4 5 6 7 8 7 9 3 8 9 10 2 4 1 PARENT(i) return i /2 LEFT(i) return 2i RIGHT(i) return 2i +1 16 14 10 8 7
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 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 informationHW #4. (mostly by) Salim Sarımurat. 1) Insert 6 2) Insert 8 3) Insert 30. 4) Insert S a.
HW #4 (mostly by) Salim Sarımurat 04.12.2009 S. 1. 1. a. 1) Insert 6 2) Insert 8 3) Insert 30 4) Insert 40 2 5) Insert 50 6) Insert 61 7) Insert 70 1. b. 1) Insert 12 2) Insert 29 3) Insert 30 4) Insert
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 informationAnalysis of Algorithms. Outline 1 Introduction Basic Definitions Ordered Trees. Fibonacci Heaps. Andres Mendez-Vazquez. October 29, Notes.
Analysis of Algorithms Fibonacci Heaps Andres Mendez-Vazquez October 29, 2015 1 / 119 Outline 1 Introduction Basic Definitions Ordered Trees 2 Binomial Trees Example 3 Fibonacci Heap Operations Fibonacci
More information5 Spatial Access Methods
5 Spatial Access Methods 5.1 Quadtree 5.2 R-tree 5.3 K-d tree 5.4 BSP tree 3 27 A 17 5 G E 4 7 13 28 B 26 11 J 29 18 K 5.5 Grid file 9 31 8 17 24 28 5.6 Summary D C 21 22 F 15 23 H Spatial Databases and
More information5 Spatial Access Methods
5 Spatial Access Methods 5.1 Quadtree 5.2 R-tree 5.3 K-d tree 5.4 BSP tree 3 27 A 17 5 G E 4 7 13 28 B 26 11 J 29 18 K 5.5 Grid file 9 31 8 17 24 28 5.6 Summary D C 21 22 F 15 23 H Spatial Databases and
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 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 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 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 informationGraphs and Trees Binary Search Trees AVL-Trees (a,b)-trees Splay-Trees. Search Trees. Tobias Lieber. April 14, 2008
Search Trees Tobias Lieber April 14, 2008 Tobias Lieber Search Trees April 14, 2008 1 / 57 Graphs and Trees Binary Search Trees AVL-Trees (a,b)-trees Splay-Trees Tobias Lieber Search Trees April 14, 2008
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 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 informationThe null-pointers in a binary search tree are replaced by pointers to special null-vertices, that do not carry any object-data
Definition 1 A red black tree is a balanced binary search tree in which each internal node has two children. Each internal node has a color, such that 1. The root is black. 2. All leaf nodes are black.
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 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 informationOptimal Tree-decomposition Balancing and Reachability on Low Treewidth Graphs
Optimal Tree-decomposition Balancing and Reachability on Low Treewidth Graphs Krishnendu Chatterjee Rasmus Ibsen-Jensen Andreas Pavlogiannis IST Austria Abstract. We consider graphs with n nodes together
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 informationMon Tue Wed Thurs Fri
In lieu of recitations 320 Office Hours Mon Tue Wed Thurs Fri 8 Cole 9 Dr. Georg Dr. Georg 10 Dr. Georg/ Jim 11 Ali Jim 12 Cole Ali 1 Cole/ Shannon Ali 2 Shannon 3 Dr. Georg Dr. Georg Jim 4 Upcoming Check
More informationFibonacci (Min-)Heap. (I draw dashed lines in place of of circular lists.) 1 / 17
Fibonacci (Min-)Heap A forest of heap-order trees (parent priority child priority). Roots in circular doubly-linked list. Pointer to minimum-priority root. Siblings in circular doubly-linked list; parent
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 informationAlgorithm Design CS 515 Fall 2015 Sample Final Exam Solutions
Algorithm Design CS 515 Fall 2015 Sample Final Exam Solutions Copyright c 2015 Andrew Klapper. All rights reserved. 1. For the functions satisfying the following three recurrences, determine which is the
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 informationEfficient Spatial Data Structure for Multiversion Management of Engineering Drawings
Efficient Structure for Multiversion Management of Engineering Drawings Yasuaki Nakamura Department of Computer and Media Technologies, Hiroshima City University Hiroshima, 731-3194, Japan and Hiroyuki
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 informationDynamic Ordered Sets with Exponential Search Trees
Dynamic Ordered Sets with Exponential Search Trees Arne Andersson Computing Science Department Information Technology, Uppsala University Box 311, SE - 751 05 Uppsala, Sweden arnea@csd.uu.se http://www.csd.uu.se/
More informationProblem: Data base too big to fit memory Disk reads are slow. Example: 1,000,000 records on disk Binary search might take 20 disk reads
B Trees Problem: Data base too big to fit memory Disk reads are slow Example: 1,000,000 records on disk Binary search might take 20 disk reads Disk reads are done in blocks Example: One block read can
More informationOptimal Color Range Reporting in One Dimension
Optimal Color Range Reporting in One Dimension Yakov Nekrich 1 and Jeffrey Scott Vitter 1 The University of Kansas. yakov.nekrich@googlemail.com, jsv@ku.edu Abstract. Color (or categorical) range reporting
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 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 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 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 informationAdvanced Data Structures
Simon Gog gog@kit.edu - Simon Gog: KIT University of the State of Baden-Wuerttemberg and National Research Center of the Helmholtz Association www.kit.edu Predecessor data structures We want to support
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 informationHash tables. Hash tables
Dictionary Definition A dictionary is a data-structure that stores a set of elements where each element has a unique key, and supports the following operations: Search(S, k) Return the element whose key
More informationAppendix of Computational Protein Design Using AND/OR Branch and Bound Search
Appendix of Computational Protein Design Using AND/OR Branch and Bound Search Yichao Zhou 1, Yuexin Wu 1, and Jianyang Zeng 1,2, 1 Institute for Interdisciplinary Information Sciences, Tsinghua University,
More informationAdvanced Data Structures
Simon Gog gog@kit.edu - Simon Gog: KIT The Research University in the Helmholtz Association www.kit.edu Predecessor data structures We want to support the following operations on a set of integers from
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 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 informationWolf-Tilo Balke Silviu Homoceanu Institut für Informationssysteme Technische Universität Braunschweig
Multimedia Databases Wolf-Tilo Balke Silviu Homoceanu Institut für Informationssysteme Technische Universität Braunschweig http://www.ifis.cs.tu-bs.de 13 Indexes for Multimedia Data 13 Indexes for Multimedia
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 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 informationData Structures 1 NTIN066
Data Structures 1 NTIN066 Jiří Fink https://kam.mff.cuni.cz/ fink/ Department of Theoretical Computer Science and Mathematical Logic Faculty of Mathematics and Physics Charles University in Prague Winter
More informationOrdered Dictionary & Binary Search Tree
Ordered Dictionary & Binary Search Tree Finite map from keys to values, assuming keys are comparable (). insert(k, v) lookup(k) aka find: the associated value if any delete(k) (Ordered set: No values;
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 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 informationMultimedia Databases 1/29/ Indexes for Multimedia Data Indexes for Multimedia Data Indexes for Multimedia Data
1/29/2010 13 Indexes for Multimedia Data 13 Indexes for Multimedia Data 13.1 R-Trees Multimedia Databases Wolf-Tilo Balke Silviu Homoceanu Institut für Informationssysteme Technische Universität Braunschweig
More informationInge Li Gørtz. Thank you to Kevin Wayne for inspiration to slides
02110 Inge Li Gørtz Thank you to Kevin Wayne for inspiration to slides Welcome Inge Li Gørtz. Reverse teaching and discussion of exercises: 3 teaching assistants 8.00-9.15 Group work 9.15-9.45 Discussions
More informationHash tables. Hash tables
Dictionary Definition A dictionary is a data-structure that stores a set of elements where each element has a unique key, and supports the following operations: Search(S, k) Return the element whose key
More informationData Structures 1 NTIN066
Data Structures 1 NTIN066 Jirka Fink Department of Theoretical Computer Science and Mathematical Logic Faculty of Mathematics and Physics Charles University in Prague Winter semester 2017/18 Last change
More informationCarnegie Mellon Univ. Dept. of Computer Science Database Applications. SAMs - Detailed outline. Spatial Access Methods - problem
Carnegie Mellon Univ. Dept. of Computer Science 15-415 - Database Applications Lecture #26: Spatial Databases (R&G ch. 28) SAMs - Detailed outline spatial access methods problem dfn R-trees Faloutsos 2
More informationLecture 5: Splay Trees
15-750: Graduate Algorithms February 3, 2016 Lecture 5: Splay Trees Lecturer: Gary Miller Scribe: Jiayi Li, Tianyi Yang 1 Introduction Recall from previous lecture that balanced binary search trees (BST)
More informationFundamental Algorithms
Fundamental Algithms Chapter 4: AVL Trees Jan Křetínský Winter 2016/17 Chapter 4: AVL Trees, Winter 2016/17 1 Part I AVL Trees (Adelson-Velsky and Landis, 1962) Chapter 4: AVL Trees, Winter 2016/17 2 Binary
More informationBiased Quantiles. Flip Korn Graham Cormode S. Muthukrishnan
Biased Quantiles Graham Cormode cormode@bell-labs.com S. Muthukrishnan muthu@cs.rutgers.edu Flip Korn flip@research.att.com Divesh Srivastava divesh@research.att.com Quantiles Quantiles summarize data
More informationNotes on Logarithmic Lower Bounds in the Cell Probe Model
Notes on Logarithmic Lower Bounds in the Cell Probe Model Kevin Zatloukal November 10, 2010 1 Overview Paper is by Mihai Pâtraşcu and Erik Demaine. Both were at MIT at the time. (Mihai is now at AT&T Labs.)
More informationAVL Trees. Properties Insertion. October 17, 2017 Cinda Heeren / Geoffrey Tien 1
AVL Trees Properties Insertion October 17, 2017 Cinda Heeren / Geoffrey Tien 1 BST rotation g g e h b h b f i a e i a c c f d d Rotations preserve the in-order BST property, while altering the tree structure
More informationpast balancing schemes require maintenance of balance info at all times, are aggresive use work of searches to pay for work of rebalancing
1 Splay Trees Sleator and Tarjan, Self Adjusting Binary Search Trees JACM 32(3) 1985 The claim planning ahead. But matches previous idea of being lazy, letting potential build up, using it to pay for expensive
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 informationChapter 10: CLP Systems
Chapter 10: CLP Systems Where we examine how CLP systems work and introduce an important concept for constraint solvers: incrementality 1 CLP Systems Simple Backtracking Goal Evaluation Incremental Constraint
More informationEvolutionary Tree Analysis. Overview
CSI/BINF 5330 Evolutionary Tree Analysis Young-Rae Cho Associate Professor Department of Computer Science Baylor University Overview Backgrounds Distance-Based Evolutionary Tree Reconstruction Character-Based
More informationReview Of Topics. Review: Induction
Review Of Topics Asymptotic notation Solving recurrences Sorting algorithms Insertion sort Merge sort Heap sort Quick sort Counting sort Radix sort Medians/order statistics Randomized algorithm Worst-case
More informationMore Dynamic Programming
CS 374: Algorithms & Models of Computation, Spring 2017 More Dynamic Programming Lecture 14 March 9, 2017 Chandra Chekuri (UIUC) CS374 1 Spring 2017 1 / 42 What is the running time of the following? Consider
More informationCS 395T Computational Learning Theory. Scribe: Mike Halcrow. x 4. x 2. x 6
CS 395T Computational Learning Theory Lecture 3: September 0, 2007 Lecturer: Adam Klivans Scribe: Mike Halcrow 3. Decision List Recap In the last class, we determined that, when learning a t-decision list,
More informationIntroduction. I Dynamic programming is a technique for solving optimization problems. I Key element: Decompose a problem into subproblems, solve them
ntroduction Computer Science & Engineering 423/823 Design and Analysis of Algorithms Lecture 03 Dynamic Programming (Chapter 15) Stephen Scott and Vinodchandran N. Variyam Dynamic programming is a technique
More informationCSE 4502/5717: Big Data Analytics
CSE 4502/5717: Big Data Analytics otes by Anthony Hershberger Lecture 4 - January, 31st, 2018 1 Problem of Sorting A known lower bound for sorting is Ω is the input size; M is the core memory size; and
More informationMore Dynamic Programming
Algorithms & Models of Computation CS/ECE 374, Fall 2017 More Dynamic Programming Lecture 14 Tuesday, October 17, 2017 Sariel Har-Peled (UIUC) CS374 1 Fall 2017 1 / 48 What is the running time of the following?
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 informationHash tables. Hash tables
Basic Probability Theory Two events A, B are independent if Conditional probability: Pr[A B] = Pr[A] Pr[B] Pr[A B] = Pr[A B] Pr[B] The expectation of a (discrete) random variable X is E[X ] = k k Pr[X
More information/463 Algorithms - Fall 2013 Solution to Assignment 4
600.363/463 Algorithms - Fall 2013 Solution to Assignment 4 (30+20 points) I (10 points) This problem brings in an extra constraint on the optimal binary search tree - for every node v, the number of nodes
More informationCPSC 320 Sample Final Examination December 2013
CPSC 320 Sample Final Examination December 2013 [10] 1. Answer each of the following questions with true or false. Give a short justification for each of your answers. [5] a. 6 n O(5 n ) lim n + This is
More informationBayesian Networks: Independencies and Inference
Bayesian Networks: Independencies and Inference Scott Davies and Andrew Moore Note to other teachers and users of these slides. Andrew and Scott would be delighted if you found this source material useful
More informationAmortized analysis. Amortized analysis
In amortized analysis the goal is to bound the worst case time of a sequence of operations on a data-structure. If n operations take T (n) time (worst case), the amortized cost of an operation is T (n)/n.
More informationUkkonen's suffix tree construction algorithm
Ukkonen's suffix tree construction algorithm aba$ $ab aba$ 2 2 1 1 $ab a ba $ 3 $ $ab a ba $ $ $ 1 2 4 1 String Algorithms; Nov 15 2007 Motivation Yet another suffix tree construction algorithm... Why?
More informationChapter 5 Arrays and Strings 5.1 Arrays as abstract data types 5.2 Contiguous representations of arrays 5.3 Sparse arrays 5.4 Representations of
Chapter 5 Arrays and Strings 5.1 Arrays as abstract data types 5.2 Contiguous representations of arrays 5.3 Sparse arrays 5.4 Representations of strings 5.5 String searching algorithms 0 5.1 Arrays as
More informationWeight-balanced Binary Search Trees
Weight-balanced Binary Search Trees Weight-balanced BSTs are one way to achieve O(lg n) tree height. For this purpose, weight means size+1: weight(x) = size(x) + 1. A weight-balanced BST: is a binary search
More informationCache-Oblivious Algorithms
Cache-Oblivious Algorithms 1 Cache-Oblivious Model 2 The Unknown Machine Algorithm C program gcc Object code linux Execution Can be executed on machines with a specific class of CPUs Algorithm Java program
More informationEven More on Dynamic Programming
Algorithms & Models of Computation CS/ECE 374, Fall 2017 Even More on Dynamic Programming Lecture 15 Thursday, October 19, 2017 Sariel Har-Peled (UIUC) CS374 1 Fall 2017 1 / 26 Part I Longest Common Subsequence
More informationHashing. Dictionaries Hashing with chaining Hash functions Linear Probing
Hashing Dictionaries Hashing with chaining Hash functions Linear Probing Hashing Dictionaries Hashing with chaining Hash functions Linear Probing Dictionaries Dictionary: Maintain a dynamic set S. Every
More informationCache-Oblivious Algorithms
Cache-Oblivious Algorithms 1 Cache-Oblivious Model 2 The Unknown Machine Algorithm C program gcc Object code linux Execution Can be executed on machines with a specific class of CPUs Algorithm Java program
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 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 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 informationA Deterministic Algorithm for Summarizing Asynchronous Streams over a Sliding Window
A Deterministic Algorithm for Summarizing Asynchronous Streams over a Sliding Window Costas Busch 1 and Srikanta Tirthapura 2 1 Department of Computer Science Rensselaer Polytechnic Institute, Troy, NY
More informationWeight-balanced Binary Search Trees
Weight-balanced Binary Search Trees Weight-balanced BSTs are one way to achieve O(lg n) tree height. A weight-balanced BST: is a binary search tree at every node v: Equivalently: ( weight means size+1)
More informationThe Algorithm (DSC): Mark all nodes as unscheduled WHILE there are unscheduled nodes DO In descending order of priority, sort list of free nodes In descending order of priority, sort list of partial free
More informationExam 1. March 12th, CS525 - Midterm Exam Solutions
Name CWID Exam 1 March 12th, 2014 CS525 - Midterm Exam s Please leave this empty! 1 2 3 4 5 Sum Things that you are not allowed to use Personal notes Textbook Printed lecture notes Phone The exam is 90
More information7.3 AVL-Trees. Definition 15. Lemma 16. AVL-trees are binary search trees that fulfill the following balance condition.
Definition 15 AVL-trees are binary search trees that fulfill the following balance condition. F eery node height(left sub-tree()) height(right sub-tree()) 1. Lemma 16 An AVL-tree of height h contains at
More informationTASM: Top-k Approximate Subtree Matching
TASM: Top-k Approximate Subtree Matching Nikolaus Augsten 1 Denilson Barbosa 2 Michael Böhlen 3 Themis Palpanas 4 1 Free University of Bozen-Bolzano, Italy augsten@inf.unibz.it 2 University of Alberta,
More informationAdministrative notes. Computational Thinking ct.cs.ubc.ca
Administrative notes Labs this week: project time. Remember, you need to pass the project in order to pass the course! (See course syllabus.) Clicker grades should be on-line now Administrative notes March
More informationLecture 17: Trees and Merge Sort 10:00 AM, Oct 15, 2018
CS17 Integrated Introduction to Computer Science Klein Contents Lecture 17: Trees and Merge Sort 10:00 AM, Oct 15, 2018 1 Tree definitions 1 2 Analysis of mergesort using a binary tree 1 3 Analysis of
More informationDS L19: B Trees
Indian Institute of Science Bangalore, India भ रत य व ज ञ न स स थ न ब गल र, भ रत Department of Computational and Data Sciences DS286 2016-10-21 L19: B Trees Yogesh Simmhan simmhan@cds.iisc.ac.in Slides
More information#A32 INTEGERS 10 (2010), TWO NEW VAN DER WAERDEN NUMBERS: w(2; 3, 17) AND w(2; 3, 18)
#A32 INTEGERS 10 (2010), 369-377 TWO NEW VAN DER WAERDEN NUMBERS: w(2; 3, 17) AND w(2; 3, 18) Tanbir Ahmed ConCoCO Research Laboratory, Department of Computer Science and Software Engineering, Concordia
More informationHierarchical Matrices. Jon Cockayne April 18, 2017
Hierarchical Matrices Jon Cockayne April 18, 2017 1 Sources Introduction to Hierarchical Matrices with Applications [Börm et al., 2003] 2 Sources Introduction to Hierarchical Matrices with Applications
More informationQuickScorer: a fast algorithm to rank documents with additive ensembles of regression trees
QuickScorer: a fast algorithm to rank documents with additive ensembles of regression trees Claudio Lucchese, Franco Maria Nardini, Raffaele Perego, Nicola Tonellotto HPC Lab, ISTI-CNR, Pisa, Italy & Tiscali
More informationMath Models of OR: Branch-and-Bound
Math Models of OR: Branch-and-Bound John E. Mitchell Department of Mathematical Sciences RPI, Troy, NY 12180 USA November 2018 Mitchell Branch-and-Bound 1 / 15 Branch-and-Bound Outline 1 Branch-and-Bound
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 information