# Structure for String Keys

Save this PDF as:

Size: px
Start display at page:

## Transcription

1 Burst Tries: A Fast, Efficient Data Structure for String Keys Steen Heinz Justin Zobel Hugh E. Williams School of Computer Science and Information Technology, RMIT University Presented by Margot Schips 22 April

2 Outline Introduction to Burst Tries What s a Trie? Applications Review of Data Structures Burst Trie, how does it work? Operation Heuristics Data Structures Experiments and Results Conclusions 2

3 Introduction to Burst Tries This paper proposes a new data structure, the Burst Trie, that has significant advantages over existing options for managing larges sets of distinct strings in memory. Advantages of Burst Tries They use about the same memory as a binary search tree They are as fast as a trie A Burst trie maintains the strings in sorted or near-sorted order (though not as fast as a hash table). 3

4 So what s a Trie? A trie is a compact data structure for representing a set of strings, such as all the words in a text. Why use a Trie? Preprocessing the pattern speeds up pattern matching queries. A trie supports pattern matching queries in time proportional to the pattern size. 4

5 Standard Tries The standard trie for a set of strings S is an ordered tree such that: Each node but the root is lbld labeled with ih a character The children of a node are alphabetically ordered The paths from the external nodes to the root yield the strings of S Example: standard trie for the set of strings S = { bear, bell, bid, bull, buy, sell, stock, stop } 5 Tries

6 Analysis of Standard Tries A standard trie uses O(n) space and supports searches, insertions and deletions in time O(dm), where: n total size of the strings in S m size of the string gparameter of the operation d size of the alphabet e b i u e t s a l d l y l o r l l l c p Tries k 6

7 Word Matching with a Trie We insert the words of the text into a trie Each leaf stores the occurrences of the associated word in the text s e e a b e a r? s e l l s t o c k! s e e a b u l l? b u y s t o c k! b i d s t o c k! b i d s t o c k! h e a r t h e b e l l? s t o p! b h s e i u e e t a l d l y a e l o r l 47, , 24 l r l c k 17, 40, Tries 51, 62 7 p 84

8 Compressed Tries A compressed trie has internal nodes of fdegree at least two b s It is obtained from standard trie e id u ell to by compressing chains of redundant nodes ar ll ll y ck p e b i u e t s a l d l y l o r l l l c p k Tries 8

9 Applications Many applications depend on efficient management of large sets of distinct strings in memory. News archives Law collections Business reports These collections contain many millions of distinct words, the number growing more or less linearly with collection size During index construction for text databases a record is held for each distinct word in the text, containing the word itself and information such as counters. 9

10 Indexing: efficiency Indexing storage needs Vocabulary Term occurrence count Individual term locations This Vocabulary Accumulation needs to be stored in a data structure. Goal: to maintain a set of records for which a string (term) is the key. Memory provides faster access than disk, so a compact data structure is preferred. 10

11 Review of Data Structures Hash Table Efficient and relatively fast (improved by bitwise hash function, chaining and move-to-front in chains), but unsorted strings are slower to update. Tries and Ternary Search Trees Fast, but space intensive Binary Search Trees including splay trees, randomised search trees and red-black tress Less space-intensive, but slow 11

12 Burst Trie, how does it work? A Burst Trie uses containers to store keys/values before creating branches. When the containers are full, they "burst"" and are turned into branches. The benefit is that a more efficient data structure for small sets of keys/values can be used in the container, making it faster than a conventional tree. 12

13 Burst Trie, how does it work? This structure is a collection of small data structures, which we call containers, that are accessed via a conventional trie. Searching involves using the first few characters of a query string to identify a particular container, then using the remainder of the query string to find a record in the container. A container can be any data structure that is reasonably efficient for small sets of strings, such as a list or a binary search tree. 13

14 Burst Trie, how does it work? Initially, a burst tree consists of a single container. When a container is deemed to be inefficient, it is burst, that is, replaced by a trie node and a set of child containers which h between them partition the original container's strings. Two major design decisions to be explored for burst tries: what data structure to use for a container how to determine when a container should be burst 14

15 Existing Data Structures, (BST) Binary Search Tree (BST) Allocation of strings to nodes determined d by insertion order Advantages Assuming a stable distribution in the text collection, with skew distribution it is expected that common words will occur close to the beginning of the text collection and are therefore close to the root of the BST. Access to common terms is fast, since first levels of tree are kept in cache. Disadvantages If BST is sorted or distribution changes (ex. Docs in multiple languages), behavior degrades. Long, non-branching paths, or sticks, create time-consuming searches. 15

16 Existing Data Structures (BST) Advantages AVL and Red-black trees Balanced trees are reorganized on insertion or deletion; eliminates long sticks found in unbalanced trees O(log n) upper limit to length of search path Disadvantages Rebalancing doesn t favor frequent access to common words at the top of the tree. Common words are just as likely to be placed in a leaf. Experiments show faster search with red-black tress in data with low skew, BST is better for typical vocabulary accumulation 16

17 Existing Data Structures (BST) Splay Trees (BST variant) Potential Advantages On each search, node accessed is moved to root by splaying, a series of node rotations Intuitively, it seems that commonly-accessed node would remain near root and would adapt quickly to change. Search time is O(log n) Disadvantages Splay Trees require more memory as efficient implementation requires each node to have a pointer to its parent. In reality, common words actually don t stay near the top, they get shifted down as newly-accessed words rise. Reorganization is expensive, better to reorganize at measured intervals. Experiments used interval of 4. 17

18 Existing Data Structures (BST) Randomised Search Tree (RST) Treap: uses inorder traversal in sort order for strings Tree reorganized using rotations to restore treap property after each search RSTs give a similar il performance as Splay Trees, so not tested t in this study 18

19 Existing Data Structures Hash Tables Chaining is most efficient hash table for vocabulary accumulation. A large array is used to index a set of linked lists of nodes. To search an array, the index is computed by hashing the query string, then the string is sought in the linked list for that index. 19

20 Existing Data Structures (Hash) For peak performance using hash tables Distinct strings must be sorted once vocabulary has been accumulated because order of slots does not correspond to string sort order. Hashing needs to be fast. Instead of standard modulus hashing, a bit- wise algorithm is employed Hash Table must be sufficiently large such that the number of slots needs to be a significant fraction of the number of distinct strings. OR can use smaller tables if, on each search, the accessed node is moved to the front of the list. This has same efficiency as large tables and, most importantly for this application, with move-to-front chains efficiency declines much more slowly with increasing vocabulary size. 20

21 Existing Data Structures (Hash) With move-to-front chains and vocabulary accumulation, over 99% of searches terminate at the first node in the slot. It is for this reason the small number of total string inspections required that, as can be seen in our experiments, hashing is the fastest of all the methods tested in this study. 21

22 Existing Data Structures (Tries) Trie A trie is an alternative to a BST for storing strings in sort order. A node in a standard trie is an array of pointers, one for each letter in the alphabet, with an additional pointer for the empty string. A leaf is a record concerning a particular string. Search in a trie is fast, requiring only a single pointer traversal for each letter in the query string. That is, the search cost is bounded by the length of the query string. 22

23 Existing Data Structures (TST) Ternary Search Trees (TSTs) TST s are a variant forms of tries with reduced space requirements and compact tries. Each node represents a single character c, and has three pointers. The left (respectively, right) pointer is for strings that start with a character that alphabetically precedes (respectively, follows) c. Thus a set of TST nodes connected by left and right pointers are a representation of a trie node. These can be rebalanced on access. The central pointer is for strings starting with c, thus corresponding to the `c' pointer of a trie node. TSTs are slower than tries, but more compact. 23

24 Hash vs. Tree In earlier work comparing the tree data structures discussed above, it was observed that compared to hashing, trees had three sources of inefficiency. First, the average search lengths were surprisingly high, typically exceeding ten pointer traversals and string comparisons (even on moderate-sized data sets with highly skew distributions). In contrast, a search under hashing rarely requires more than a string traversal to compute a hash value and a single successful comparison. Second, for structures based on BSTs, the string comparisons involved redundant d character inspections, and were thus unnecessarily expensive. For example, given the query string middle and given that, during search, michael and midfield have been encountered, it is clear that all subsequent strings inspected must begin with the prefix mi. Third, in tries the set of strings in a subtrie tends to have a highly skew distribution: typically the vast majority of accesses to a subtrie are to find one particular string. Thus use of a highly time-efficient, space-intensive structure for the remaining strings is not a good use of resources. 24

25 Why Burst Tries? So far trees are slow, redundant, and inefficient for high skew data such as text data Can we improve upon their design? Yes! 25

26 Burst Tries, goals The primary design goal for the burst trie is to reduce the average number of string comparisons required during a search to less than two. This requires an adaptive structure that stores more frequent terms such that they can be retrieved more rapidly than less frequent terms. As a secondary goal, any gains in performance should not be offset by impractical memory requirements, as observed in tries. 26

27 Burst Trie, cont A burst trie is an in-memory data structure, designed for sets of records that each have a unique string that identifies the record and acts as a key. A string s with length n consists of a series of symbols or characters c i for i = 0,, n, chosen from an alphabet A of size A. We assume that A is small, typically y no greater than

28 Burst Trie Components A burst trie consists of three distinct components, a set of Records, a set of Containers, and an Access Trie: Records. A record contains a string; information as required by the application using the burst trie (i.e., for information such as word locations) and pointers as required to maintain the container holding the record. Each string is unique. 28

29 Burst Trie Components Containers. A container is a small set of records, maintained as a simple data structure such as a list or a BST. For a container at depth k in a burst trie (depth is discussed below), all strings have length at least k, and the first k characters of all strings are identical. It is not necessary to store these first k characters. Thus a particular container at depth 3 containing author" and automated" could also contain autopsy" but not auger". Each container also has a header, for storing the statistics used by heuristics for bursting. 29

30 Burst Trie Components Access trie. An access trie is a trie whose leaves are containers. Each node consists of an array p, of length A, of pointers each of which may point to either a trie node or a container, and a single empty-string pointer to a record. The Aj array locations are indexed by the characters c A. The remaining pointer is indexed by the empty string. The depth of the root is defined to be 1. Leaves are at varying depths. 30

31 Burst Trie Components Figure 1 shows an example of a burst trie storing ten records whose keys are came, car, cat, cave, cy, cyan, we, went, were, and west respectively. 31

32 Burst Trie Operations There are three main operations applied to the tree: Searching Insertion Bursting 32

33 Burst Trie Operations, Searching The access trie is traversed according to the leading characters in the query string. Initially the current object is the root of the access trie and the current depth i is 1. While the current object is a trie node t of depth i n, (a) Update the current object to be the node or container pointed to by the c th i element of t's array p, and (b) Increment i. If the current object is a trie node t of depth i = n + 1, the current object is the object pointed to by the empty-string pointer, which for simplicity can be regarded as a container of either zero or one records. Otherwise, if the current object is null the string is not in the burst trie, and search terminates. 33

34 Burst Trie Operations, Searching If i n, use the remaining characters c i,,c n to search the container, returning the record if found or otherwise returning null. Note that in many languages the most common words are typically short. Thus these terms are typically stored at an empty-string py gpointer, and are found after simply pyfollowing a small number of access trie pointers with no search in a container at all. 34

35 Burst Trie Operations, Insertion Consider input of a new string c 1,, c n of length n Stage 1 of the search algorithm above is used to identify the container in which the record should be inserted. This container, which can be empty, is at depth k. For the special case of arriving at a trie node at depth k = n + 1, the container is under the empty-string py gpointer. If k n, the standard insertion algorithm for the container data structure is used to add the record to the container, using only the suffix characters c k+1,, c n. Otherwise, the record is added under the empty-string pointer. 35

36 Burst Trie Operations, Insertion Figure 2 shows the example burst trie after the insertion of the record with key western. 36

37 Burst Trie Operations, Bursting Bursting is the process of replacing a container at depth k by a trie node and a set of new containers at depth k+1, which between them contain all the records in the original container. 37

38 Burst Trie Heuristics A successful bursting strategy should ensure that common strings are found quickly via the access trie, without excessive searching within containers. Appropriate management of containers (such as move-to-front in lists) should also be helpful in reducing search costs. Containers that are rarely accessed should not be burst, since containers should be more space-efficient than trie nodes. A goal of bursting is to transform containers that have high average search costs, without bursting unnecessarily. 38

39 Burst Trie Heuristics A design goal for the tested heuristics was that they could be cheaply evaluated. They do not require a thorough inspection of a container to decide whether to burst. Instead, the heuristics use counters for each container. The Three Heuristics tested Ratio Limit Trend 39

40 Burst Trie Heuristics, Ratio The Ratio heuristic utilizes 2 counters to keep track of 2 values the number of times a container has been searched The number of searches that have ended successfully at the root node of that container (direct hits) We calculate the ratio R between the number of accesses and the number of direct hits for each container. This ratio is used to determine whether to burst. Potential Advantage R is only tested once the total number of accesses exceeds some threshold, thereby containers that are rarely accessed are burst Potential Disadvantage additional memory required to maintain two counters per container, and the number of tests required at each access. 40

41 Burst Trie Heuristics, Ratio Ratio Example If less than, say, R = 80% of all accesses into a container are direct hits and there have been at least, say, 100 accesses to the container in total, it should be burst. 41

42 Burst Trie Heuristics, Limit The Limit heuristic bursts a container whenever it contains more than a fixed number L of records. Potential Advantages By eliminating large containers, we limit total search costs. Compared to Ratio, only a single counter is required, and this need only be tested on insertion. Provides reasonable performance even if the distribution of strings is completely uniform. Potential disadvantages. The burst trie with Limit is likely to be slow if there is a container with less than K terms but all are very common, so that there are many accesses to the container but not many direct hits. However, this can only arise if these terms and no others share a common prefix, not a probable occurrence. Containers with only rare strings are burst. 42

43 Burst Trie Heuristics, Trend The Trend heuristic allocates each newly-created container a set amount of capital C. The current capital is modified on each access. On a direct hit, the capital is incremented by a bonus B. If a record is accessed that is already in the container, but is not a direct hit, the capital is decremented by a penalty M. When the capital is exhausted, the container is burst. Thus if the accesses are sufficiently skew, the bonuses will offset the penalties, and the container will not burst. The use of a start capital ensures that even containers with a uniform distribution will not burst until after a certain number of accesses. Testing revealed this good choice of Trend parameters: start capital C of 5000, bonus B of 4, and penalty M of

44 Container Data Structures Data Structures should allow reasonable efficient insertion and search for records over small data sets. This study considers: Linked Lists Binary Search Trees Splay Trees 44

45 Container Data Structures Data Structures should allow reasonable efficient insertion and search for records over small data sets. This study considers: Linked Lists Binary Search Trees Splay Trees (Hash tables were not considered as they are not efficient for small numbers of items.) 45

46 Container Data Structures, t Linked List Advantages Low overhead = space efficient Disadvantages Access costs are high in unordered list Solution: Move-to-Front list (most recently accessed node moved to front position. Provides adaptation to local changes in vocabulary. 46

47 Container Data Structures, BST Advantages Shorter average search paths than list Disadvantages Position based on order of insertion, not frequency Solution: when a BST is burst, sort the records by decreasing frequency, then distribute to the new containers. 47

48 Container Data Structures, t Splay Trees Advantage Since frequently-accessed records should be kept near the root, the structure provides adaptation to changing vocabulary and, in common with move-to-front lists, may lead to less bursting. Disadvantage For efficient splaying, a record in a splay tree requires three pointers, two to its children and one to its parent. Thus they use the most space of any of the container structures we consider. 48

49 Experiments 49

50 Test Data, Text The data sets drawn from the large Web track in the TREC (Text Research Conference) project. The five groups contain collections of web pages extracted from the Internet Archive for use in TREC retrieval experiments. These collections show the skew distribution that is typical of text. A word, in these experiments, is an alphanumeric string containing no more than two integers and not starting with an integer. All words are converted to lower case. XML and HTML markup, special characters, and punctuation are skipped. 50

51 Test Data, Non-text Non-text collections used for comparison Genomic Data: a collection of nucleotide strings, each typically thousands of nucleotides in length, with an alphabet of 4 characters. It is parsed into shorter strings by extracting n-grams of length 9. (Such 9-grams are commonly used by genomic search utilities to locate regions where a longer inexact match may be found.) Music Data: consisting of pieces in MIDI format stored in a textual representation, using an alphabet of 27 characters. Extract n-grams of length 7 from the music data, an approach used in indexing MIDI files. These n-grams are extracted by sliding a window over the data and taking every consecutive block of n characters. 51

52 Test Data, Non-text Table 2 shows the statistics of the non-text collections. They do not show the skew distribution that is typical of text. This low-skew data sets are expected to perform poorly using Burst Tries 52

53 Methodology Goals Explore the different burst heuristics and choices of container structure to identify which yield good performance, Compare burst tries to the other principal data structures for vocabulary accumulation in terms of running time and memory usage. The data structure stores for each term its total occurrence frequency and the number of documents in which it occurs. 53

54 Reference Data Structures Measurements of time and space requirements of five reference data structures: compact tries (which we simply py refer to as tries), TSTs, BSTs, splay trees, and hash tables. For splay trees, two variants of splaying are tested: where the tree is splayed at every access, and where it is splayed intermittently (at every fourth access) For hash tables, a hash with 2 20 slots and a bit-wise hash function was used. 54

55 55 Reference Data Structures

56 56 Results, TREC1 RATIO

57 57 Results, WEB M RATIO

58 Results, RATIO As container structures, lists, BSTs and splay trees all yield a similar curve. However, the ratios that achieve particular points on the curve vary. For example, a BST with ratio 45 is about as efficient as a list with ratio 65. This is because a list of n nodes uses less space than a BST of n nodes, but is less efficient; lists require a higher ratio for the same efficiency. Similar results were obtained from the other 3 data sets 58

59 59 Results, TREC1 LIMIT

60 60 Results, WEB M LIMIT

61 Results, LIMIT For all but extremely small containers, Limit greatly outperforms Ratio for all container structures. Also, BST containers are faster for given memory than either list or splay tree containers. The best results with Limit show that burst tries can be much more ecient than any other tree or trie structure. For example, the slowest run with BSTs as containers with limit L = 100 uses only 15 Mb and requires 66 seconds. This is less memory than any existing tree structure tested, even standard BSTs, and is faster than tries and almost three times faster than BSTs or splay trees. Only hashing is faster, by about 27%. Results for BST containers with the Limit heuristic and all text data sets show that the gains achieved by burst tries, in comparison to the reference data structures, are consistent for all these data sets. 61

62 Results, LIMIT, cont Results for the non-text data sets show that with the genomic data the burst trie did not do well: it is slower than the TST and half the speed of hashing. Nonetheless, it is still much faster than the other tree structures, and is the most compact of all data structures tested. With the music data the burst trie showed the best observed performance observed, faster than any other data structure tested including hash tables with good space utilization. 62

63 63 Results TREND TREC 1

64 Results TREND Results on TREC 1 are typical of all text data sets where M is varied and the other parameters are held constant. It was expected that the Trend heuristic would be the best of all, as it was likely to lead to containers being burst more rapidly if they held common terms, and more slowly otherwise, but the results do not approach those of Limit. Despite wide investigation, further testing did not identify combinations of parameters with significantly better performance than that shown in these graphs. 64

65 Conclusions Burst Tries are highly efficient for managing large sets of strings in memory. Use of Containers allow dramatic space reductions with no impact on efficiency. Experiments show that Burst Tries are Faster than compact tries, using 1/6 of the space More compact than binary trees or splay trees and are over two times faster Close to hash tables in efficiency, yet keep the data in sort order. The Burst Trie is dramatically more efficient than any previously known structure for the task of managing sorted strings. 65

66 Resources 1. Burst Tries: A Fast, Efficient Data Structure for String Keys Hi Heinz, Zobel, Williams; School of Computer Science and Information Technology, RMIT University (Australia) /bursttries.pdf 2. Data Structures and Algorithms in Java (4th edition), John Wiley & Sons, Inc., Michael T. Goodrich and Roberto Tamassia 3. D. Harman. Overview of the second text retrieval conference (TREC-2). InformationProcessing & Management, 31(3):271{289,

### Physical Data Organization

Physical Data Organization Database design using logical model of the database - appropriate level for users to focus on - user independence from implementation details Performance - other major factor

### Symbol Tables. Introduction

Symbol Tables Introduction A compiler needs to collect and use information about the names appearing in the source program. This information is entered into a data structure called a symbol table. The

### Inverted Indexes Compressed Inverted Indexes. Indexing and Searching, Modern Information Retrieval, Addison Wesley, 2010 p. 40

Inverted Indexes Compressed Inverted Indexes Indexing and Searching, Modern Information Retrieval, Addison Wesley, 2010 p. 40 Compressed Inverted Indexes It is possible to combine index compression and

### A Comparison of Dictionary Implementations

A Comparison of Dictionary Implementations Mark P Neyer April 10, 2009 1 Introduction A common problem in computer science is the representation of a mapping between two sets. A mapping f : A B is a function

### Database 2 Lecture II. Alessandro Artale

Free University of Bolzano Database 2. Lecture II, 2003/2004 A.Artale (1) Database 2 Lecture II Alessandro Artale Faculty of Computer Science Free University of Bolzano Room: 221 artale@inf.unibz.it http://www.inf.unibz.it/

### Previous Lectures. B-Trees. External storage. Two types of memory. B-trees. Main principles

B-Trees Algorithms and data structures for external memory as opposed to the main memory B-Trees Previous Lectures Height balanced binary search trees: AVL trees, red-black trees. Multiway search trees:

### Storage Management for Files of Dynamic Records

Storage Management for Files of Dynamic Records Justin Zobel Department of Computer Science, RMIT, GPO Box 2476V, Melbourne 3001, Australia. jz@cs.rmit.edu.au Alistair Moffat Department of Computer Science

### Balanced Trees Part One

Balanced Trees Part One Balanced Trees Balanced trees are surprisingly versatile data structures. Many programming languages ship with a balanced tree library. C++: std::map / std::set Java: TreeMap /

### BINARY SEARCH TREE PERFORMANCE

BINARY SEARCH TREE PERFORMANCE Operation Best Time Average Time Worst Time (on a tree of n nodes) Find Insert Delete O(lg n)?? O(lg n)?? O(n) Fastest Running Time The find, insert and delete algorithms

### Announcements. CSE332: Data Abstractions. Lecture 9: B Trees. Today. Our goal. M-ary Search Tree. M-ary Search Tree. Ruth Anderson Winter 2011

Announcements CSE2: Data Abstractions Project 2 posted! Partner selection due by 11pm Tues 1/25 at the latest. Homework due Friday Jan 28 st at the BEGINNING of lecture Lecture 9: B Trees Ruth Anderson

### 12 Abstract Data Types

12 Abstract Data Types 12.1 Source: Foundations of Computer Science Cengage Learning Objectives After studying this chapter, the student should be able to: Define the concept of an abstract data type (ADT).

### Multi-Way Search Trees (B Trees)

Multi-Way Search Trees (B Trees) Multiway Search Trees An m-way search tree is a tree in which, for some integer m called the order of the tree, each node has at most m children. If n

### Techniques Covered in this Class. Inverted List Compression Techniques. Recap: Search Engine Query Processing. Recap: Search Engine Query Processing

Recap: Search Engine Query Processing Basically, to process a query we need to traverse the inverted lists of the query terms Lists are very long and are stored on disks Challenge: traverse lists as quickly

### DATA STRUCTURES USING C

DATA STRUCTURES USING C QUESTION BANK UNIT I 1. Define data. 2. Define Entity. 3. Define information. 4. Define Array. 5. Define data structure. 6. Give any two applications of data structures. 7. Give

### CS/COE 1501

CS/COE 1501 www.cs.pitt.edu/~nlf4/cs1501/ Searching Symbol tables Abstract structures that link keys to values Key is used to search the data structure for a value Described as a class in the text, but

### From Last Time: Remove (Delete) Operation

CSE 32 Lecture : More on Search Trees Today s Topics: Lazy Operations Run Time Analysis of Binary Search Tree Operations Balanced Search Trees AVL Trees and Rotations Covered in Chapter of the text From

### DATABASE DESIGN - 1DL400

DATABASE DESIGN - 1DL400 Spring 2015 A course on modern database systems!! http://www.it.uu.se/research/group/udbl/kurser/dbii_vt15/ Kjell Orsborn! Uppsala Database Laboratory! Department of Information

### B-Trees. Algorithms and data structures for external memory as opposed to the main memory B-Trees. B -trees

B-Trees Algorithms and data structures for external memory as opposed to the main memory B-Trees Previous Lectures Height balanced binary search trees: AVL trees, red-black trees. Multiway search trees:

### 2. Compressing data to reduce the amount of transmitted data (e.g., to save money).

Presentation Layer The presentation layer is concerned with preserving the meaning of information sent across a network. The presentation layer may represent (encode) the data in various ways (e.g., data

### TREE BASIC TERMINOLOGIES

TREE Trees are very flexible, versatile and powerful non-liner data structure that can be used to represent data items possessing hierarchical relationship between the grand father and his children and

### Symbol Tables. IE 496 Lecture 13

Symbol Tables IE 496 Lecture 13 Reading for This Lecture Horowitz and Sahni, Chapter 2 Symbol Tables and Dictionaries A symbol table is a data structure for storing a list of items, each with a key and

### VISUAL BASIC COLLECTIONS

VISUAL BASIC COLLECTIONS AND HASH TABLES Thomas Niemann Preface Hash tables offer a method for quickly storing and accessing data based on a key value. When you access a Visual Basic collection using a

### SMALL INDEX LARGE INDEX (SILT)

Wayne State University ECE 7650: Scalable and Secure Internet Services and Architecture SMALL INDEX LARGE INDEX (SILT) A Memory Efficient High Performance Key Value Store QA REPORT Instructor: Dr. Song

### Converting a Number from Decimal to Binary

Converting a Number from Decimal to Binary Convert nonnegative integer in decimal format (base 10) into equivalent binary number (base 2) Rightmost bit of x Remainder of x after division by two Recursive

### CSE 326, Data Structures. Sample Final Exam. Problem Max Points Score 1 14 (2x7) 2 18 (3x6) 3 4 4 7 5 9 6 16 7 8 8 4 9 8 10 4 Total 92.

Name: Email ID: CSE 326, Data Structures Section: Sample Final Exam Instructions: The exam is closed book, closed notes. Unless otherwise stated, N denotes the number of elements in the data structure

### Krishna Institute of Engineering & Technology, Ghaziabad Department of Computer Application MCA-213 : DATA STRUCTURES USING C

Tutorial#1 Q 1:- Explain the terms data, elementary item, entity, primary key, domain, attribute and information? Also give examples in support of your answer? Q 2:- What is a Data Type? Differentiate

### Multimedia Communications. Huffman Coding

Multimedia Communications Huffman Coding Optimal codes Suppose that a i -> w i C + is an encoding scheme for a source alphabet A={a 1,, a N }. Suppose that the source letter a 1,, a N occur with relative

### Data storage Tree indexes

Data storage Tree indexes Rasmus Pagh February 7 lecture 1 Access paths For many database queries and updates, only a small fraction of the data needs to be accessed. Extreme examples are looking or updating

### Record Storage and Primary File Organization

Record Storage and Primary File Organization 1 C H A P T E R 4 Contents Introduction Secondary Storage Devices Buffering of Blocks Placing File Records on Disk Operations on Files Files of Unordered Records

### CSE 326: Data Structures B-Trees and B+ Trees

Announcements (4//08) CSE 26: Data Structures B-Trees and B+ Trees Brian Curless Spring 2008 Midterm on Friday Special office hour: 4:-5: Thursday in Jaech Gallery (6 th floor of CSE building) This is

### Chapter 13. Disk Storage, Basic File Structures, and Hashing

Chapter 13 Disk Storage, Basic File Structures, and Hashing Chapter Outline Disk Storage Devices Files of Records Operations on Files Unordered Files Ordered Files Hashed Files Dynamic and Extendible Hashing

### Review of Hashing: Integer Keys

CSE 326 Lecture 13: Much ado about Hashing Today s munchies to munch on: Review of Hashing Collision Resolution by: Separate Chaining Open Addressing \$ Linear/Quadratic Probing \$ Double Hashing Rehashing

### Learning Outcomes. COMP202 Complexity of Algorithms. Binary Search Trees and Other Search Trees

Learning Outcomes COMP202 Complexity of Algorithms Binary Search Trees and Other Search Trees [See relevant sections in chapters 2 and 3 in Goodrich and Tamassia.] At the conclusion of this set of lecture

### Record Storage, File Organization, and Indexes

Record Storage, File Organization, and Indexes ISM6217 - Advanced Database Updated October 2005 1 Physical Database Design Phase! Inputs into the Physical Design Phase " Logical (implementation) model

Chapter 7 Linked Lists In order to use linked lists, you need to learn how to allocate memory dynamically on the heap and you need to learn about objects. Recall that local variables are temporary which

### Binary Heap Algorithms

CS Data Structures and Algorithms Lecture Slides Wednesday, April 5, 2009 Glenn G. Chappell Department of Computer Science University of Alaska Fairbanks CHAPPELLG@member.ams.org 2005 2009 Glenn G. Chappell

### Original-page small file oriented EXT3 file storage system

Original-page small file oriented EXT3 file storage system Zhang Weizhe, Hui He, Zhang Qizhen School of Computer Science and Technology, Harbin Institute of Technology, Harbin E-mail: wzzhang@hit.edu.cn

### Binary Search Trees > = Binary Search Trees 1. 2004 Goodrich, Tamassia

Binary Search Trees < 6 2 > = 1 4 8 9 Binary Search Trees 1 Binary Search Trees A binary search tree is a binary tree storing keyvalue entries at its internal nodes and satisfying the following property:

### Chapter 13 Disk Storage, Basic File Structures, and Hashing.

Chapter 13 Disk Storage, Basic File Structures, and Hashing. Copyright 2004 Pearson Education, Inc. Chapter Outline Disk Storage Devices Files of Records Operations on Files Unordered Files Ordered Files

### character E T A S R I O D frequency

Data Compression Data compression is any process by which a digital (e.g. electronic) file may be transformed to another ( compressed ) file, such that the original file may be fully recovered from the

### A Hybrid Chaining Model with AVL and Binary Search Tree to Enhance Search Speed in Hashing

, pp.185-194 http://dx.doi.org/10.14257/ijhit.2015.8.3.18 A Hybrid Chaining Model with AVL and Binary Search Tree to Enhance Search Speed in Hashing 1 Akshay Saxena, 2 Harsh Anand, 3 Tribikram Pradhan

### Chapter 4 Index Structures

Chapter 4 Index Structures Having seen the options available for representing records, we must now consider how whole relations, or the extents of classes, are represented. It is not sufficient 4.1. INDEXES

### Fast Sequential Summation Algorithms Using Augmented Data Structures

Fast Sequential Summation Algorithms Using Augmented Data Structures Vadim Stadnik vadim.stadnik@gmail.com Abstract This paper provides an introduction to the design of augmented data structures that offer

### A Fast Method For Accessing Nodes In The Binary Search Trees

A Fast Method For Accessing Nodes In The Binary Search Trees İbrahim Ates, Mustafa Akpınar, Beyza Eken, Nejat YUMUSAK Sakarya University, Department of Computer Engineering, Serdivan-Sakarya, Turkey ibrahimates@yahoo.com

### Balanced search trees

Lecture 8 Balanced search trees 8.1 Overview In this lecture we discuss search trees as a method for storing data in a way that supports fast insert, lookup, and delete operations. (Data structures handling

### Information Theory and Coding Prof. S. N. Merchant Department of Electrical Engineering Indian Institute of Technology, Bombay

Information Theory and Coding Prof. S. N. Merchant Department of Electrical Engineering Indian Institute of Technology, Bombay Lecture - 14 Non-Binary Huffman Code and Other Codes In the last class we

### CS 2112 Spring 2014. 0 Instructions. Assignment 3 Data Structures and Web Filtering. 0.1 Grading. 0.2 Partners. 0.3 Restrictions

CS 2112 Spring 2014 Assignment 3 Data Structures and Web Filtering Due: March 4, 2014 11:59 PM Implementing spam blacklists and web filters requires matching candidate domain names and URLs very rapidly

### Persistent Binary Search Trees

Persistent Binary Search Trees Datastructures, UvA. May 30, 2008 0440949, Andreas van Cranenburgh Abstract A persistent binary tree allows access to all previous versions of the tree. This paper presents

### Binary Search Trees. A Generic Tree. Binary Trees. Nodes in a binary search tree ( B-S-T) are of the form. P parent. Key. Satellite data L R

Binary Search Trees A Generic Tree Nodes in a binary search tree ( B-S-T) are of the form P parent Key A Satellite data L R B C D E F G H I J The B-S-T has a root node which is the only node whose parent

### Storing Data: Disks and Files

Storing Data: Disks and Files [R&G] Chapter 9 CS 4320 1 Data on External Storage Disks: Can retrieve random page at fixed cost But reading several consecutive pages is much cheaper than reading them in

### Lecture 6. Randomized data structures Random number generation Skip lists: ideas and implementation Skip list time costs. Reading:

Lecture 6 Randomized data structures Random number generation Skip lists: ideas and implementation Skip list time costs Reading: Skip Lists: A Probabilistic Alternative to Balanced Trees (author William

### File Systems: Fundamentals

Files What is a file? A named collection of related information recorded on secondary storage (e.g., disks) File Systems: Fundamentals File attributes Name, type, location, size, protection, creator, creation

### Last Class: Memory Management. Recap: Paging

Last Class: Memory Management Static & Dynamic Relocation Fragmentation Paging Lecture 12, page 1 Recap: Paging Processes typically do not use their entire space in memory all the time. Paging 1. divides

### Heap. Binary Search Tree. Heaps VS BSTs. < el el. Difference between a heap and a BST:

Heaps VS BSTs Difference between a heap and a BST: Heap el Binary Search Tree el el el < el el Perfectly balanced at all times Immediate access to maximal element Easy to code Does not provide efficient

Chapter 7. Indexes Table of Contents Objectives... 1 Introduction... 2 Context... 2 Review Questions... 3 Single-level Ordered Indexes... 4 Primary Indexes... 4 Clustering Indexes... 8 Secondary Indexes...

### Chapter 7. Multiway Trees. Data Structures and Algorithms in Java

Chapter 7 Multiway Trees Data Structures and Algorithms in Java Objectives Discuss the following topics: The Family of B-Trees Tries Case Study: Spell Checker Data Structures and Algorithms in Java 2 Multiway

### Copyright 2007 Ramez Elmasri and Shamkant B. Navathe. Slide 13-1

Slide 13-1 Chapter 13 Disk Storage, Basic File Structures, and Hashing Chapter Outline Disk Storage Devices Files of Records Operations on Files Unordered Files Ordered Files Hashed Files Dynamic and Extendible

### Ngram Search Engine with Patterns Combining Token, POS, Chunk and NE Information

Ngram Search Engine with Patterns Combining Token, POS, Chunk and NE Information Satoshi Sekine Computer Science Department New York University sekine@cs.nyu.edu Kapil Dalwani Computer Science Department

### Datenbanksysteme II: Hashing. Ulf Leser

Datenbanksysteme II: Hashing Ulf Leser Content of this Lecture Hashing Extensible Hashing Linear Hashing Ulf Leser: Implementation of Database Systems, Winter Semester 2012/2013 2 Sorting or Hashing Sorted

### Ordered Lists and Binary Trees

Data Structures and Algorithms Ordered Lists and Binary Trees Chris Brooks Department of Computer Science University of San Francisco Department of Computer Science University of San Francisco p.1/62 6-0:

### AVL Trees. CSE 373 Data Structures

AVL Trees CSE 373 Data Structures Readings Reading Chapter 1 Section 1.2 AVL Trees 2 Binary Search Tree - Best Time All BST operations are O(d), where d is tree depth minimum d is = log N for a binary

### Problem. Indexing with B-trees. Indexing. Primary Key Indexing. B-trees. B-trees: Example. primary key indexing

Problem Given a large collection of records, Indexing with B-trees find similar/interesting things, i.e., allow fast, approximate queries Anastassia Ailamaki http://www.cs.cmu.edu/~natassa 2 Indexing Primary

### 10CS35: Data Structures Using C

CS35: Data Structures Using C QUESTION BANK REVIEW OF STRUCTURES AND POINTERS, INTRODUCTION TO SPECIAL FEATURES OF C OBJECTIVE: Learn : Usage of structures, unions - a conventional tool for handling a

### Information Retrieval

Information Retrieval Indexes All slides unless specifically mentioned are Addison Wesley, 2008; Anton Leuski & Donald Metzler 2012 1 Search Process Information need query text objects representation representation

### SEARCHING AND SORTING

SEARCHING AND SORTING Searching A basic operation in computer science Problem formulation Given: Collection (array) of values A property on values Find: a value having the property in the array Examples

### Chapter 22. Working with Arrays Sorting Arrays

265 Chapter 22 Working with Arrays This chapter introduces fundamental algorithms for arrays sorting and searching and then finishes with a sample application that uses arrays. 22.1 Sorting Arrays Array

### Chapter 13. Chapter Outline. Disk Storage, Basic File Structures, and Hashing

Chapter 13 Disk Storage, Basic File Structures, and Hashing Copyright 2007 Ramez Elmasri and Shamkant B. Navathe Chapter Outline Disk Storage Devices Files of Records Operations on Files Unordered Files

### 6. Storage and File Structures

ECS-165A WQ 11 110 6. Storage and File Structures Goals Understand the basic concepts underlying different storage media, buffer management, files structures, and organization of records in files. Contents

### CS 210 Algorithms and Data Structures College of Information Technology and Engineering Weisberg Division of Engineering and Computer Science

CS 210 Algorithms and Data Structures College of Information Technology and Engineering Weisberg Division of Engineering and Computer Science Semester and Year: Spring 2009 Classroom Section, Meeting Times,

### Suppose you are accessing elements of an array: ... or suppose you are dereferencing pointers:

CSE 100: B-TREE Memory accesses Suppose you are accessing elements of an array: if ( a[i] < a[j] ) {... or suppose you are dereferencing pointers: temp->next->next = elem->prev->prev;... or in general

### 2 Exercises and Solutions

2 Exercises and Solutions Most of the exercises below have solutions but you should try first to solve them. Each subsection with solutions is after the corresponding subsection with exercises. 2.1 Sorting

### CHAPTER 5 A MEMORY EFFICIENT SPEECH CODING SCHEME WITH FAST DECODING

86 CHAPTE A MEMOY EFFICIENT SPEECH CODING SCHEME WITH FAST DECODING. INTODUCTION Huffman coding proposed by Huffman (9) is the most widely used minimal prefix coding algorithm because of its robustness,

### B-tries for disk-based string management

The VLDB Journal (2009) 18:157 179 DOI 10.1007/s00778-008-0094-1 REGULAR PAPER B-tries for disk-based string management Nikolas Askitis Justin Zobel Received: 11 June 2006 / Revised: 14 December 2007 /

### An Evaluation of Self-adjusting Binary Search Tree Techniques

SOFTWARE PRACTICE AND EXPERIENCE, VOL. 23(4), 369 382 (APRIL 1993) An Evaluation of Self-adjusting Binary Search Tree Techniques jim bell and gopal gupta Department of Computer Science, James Cook University,

### Information Retrieval

Information Retrieval ETH Zürich, Fall 2012 Thomas Hofmann LECTURE 4 INDEX COMPRESSION 10.10.2012 Information Retrieval, ETHZ 2012 1 Overview 1. Dictionary Compression 2. Zipf s Law 3. Posting List Compression

### CSE 5311 Homework 2 Solution

CSE 5311 Homework 2 Solution Problem 6.2-6 Show that the worst-case running time of MAX-HEAPIFY on a heap of size n is Ω(lg n). (Hint: For a heap with n nodes, give node values that cause MAX- HEAPIFY

### Compression for IR. Lecture 5. Lecture 5 Information Retrieval 1

Compression for IR Lecture 5 Lecture 5 Information Retrieval 1 IR System Layout Lexicon (w, *occ) Occurrences (d, f t,d ) Locations (d, *pos) Documents 2 Why Use Compression? More storage inverted file

### File System Management

Lecture 7: Storage Management File System Management Contents Non volatile memory Tape, HDD, SSD Files & File System Interface Directories & their Organization File System Implementation Disk Space Allocation

### The relationship of a trees to a graph is very important in solving many problems in Maths and Computer Science

Trees Mathematically speaking trees are a special class of a graph. The relationship of a trees to a graph is very important in solving many problems in Maths and Computer Science However, in computer

### Query Processing, optimization, and indexing techniques

Query Processing, optimization, and indexing techniques What s s this tutorial about? From here: SELECT C.name AS Course, count(s.students) AS Cnt FROM courses C, subscription S WHERE C.lecturer = Calders

### Unit 4.3 - Storage Structures 1. Storage Structures. Unit 4.3

Storage Structures Unit 4.3 Unit 4.3 - Storage Structures 1 The Physical Store Storage Capacity Medium Transfer Rate Seek Time Main Memory 800 MB/s 500 MB Instant Hard Drive 10 MB/s 120 GB 10 ms CD-ROM

### COT5405 Analysis of Algorithms Homework 3 Solutions

COT0 Analysis of Algorithms Homework 3 Solutions. Prove or give a counter example: (a) In the textbook, we have two routines for graph traversal - DFS(G) and BFS(G,s) - where G is a graph and s is any

### Data Structures and Data Manipulation

Data Structures and Data Manipulation What the Specification Says: Explain how static data structures may be used to implement dynamic data structures; Describe algorithms for the insertion, retrieval

### Binary Search Trees 3/20/14

Binary Search Trees 3/0/4 Presentation for use ith the textbook Data Structures and Algorithms in Java, th edition, by M. T. Goodrich, R. Tamassia, and M. H. Goldasser, Wiley, 04 Binary Search Trees 4

### In-Memory Databases MemSQL

IT4BI - Université Libre de Bruxelles In-Memory Databases MemSQL Gabby Nikolova Thao Ha Contents I. In-memory Databases...4 1. Concept:...4 2. Indexing:...4 a. b. c. d. AVL Tree:...4 B-Tree and B+ Tree:...5

### Heaps & Priority Queues in the C++ STL 2-3 Trees

Heaps & Priority Queues in the C++ STL 2-3 Trees CS 3 Data Structures and Algorithms Lecture Slides Friday, April 7, 2009 Glenn G. Chappell Department of Computer Science University of Alaska Fairbanks

### Lecture 1: Data Storage & Index

Lecture 1: Data Storage & Index R&G Chapter 8-11 Concurrency control Query Execution and Optimization Relational Operators File & Access Methods Buffer Management Disk Space Management Recovery Manager

### A. V. Gerbessiotis CS Spring 2014 PS 3 Mar 24, 2014 No points

A. V. Gerbessiotis CS 610-102 Spring 2014 PS 3 Mar 24, 2014 No points Problem 1. Suppose that we insert n keys into a hash table of size m using open addressing and uniform hashing. Let p(n, m) be the

### Cache Configuration Reference

Sitecore CMS 6.2 Cache Configuration Reference Rev: 2009-11-20 Sitecore CMS 6.2 Cache Configuration Reference Tips and Techniques for Administrators and Developers Table of Contents Chapter 1 Introduction...

### Evaluating Alternative Structures for Prefix Trees

, 22-24 October, 2014, San Francisco, USA Evaluating Alternative Structures for Prefix Trees Feras Hanandeh, Izzat Alsmadi and Muhammad M. Kwafha Abstract Prefix trees or tries are data structures that

### Tree Properties (size vs height) Balanced Binary Trees

Tree Properties (size vs height) Balanced Binary Trees Due now: WA 7 (This is the end of the grace period). Note that a grace period takes the place of a late day. Now is the last time you can turn this

### Big Data Technology Map-Reduce Motivation: Indexing in Search Engines

Big Data Technology Map-Reduce Motivation: Indexing in Search Engines Edward Bortnikov & Ronny Lempel Yahoo Labs, Haifa Indexing in Search Engines Information Retrieval s two main stages: Indexing process

### Database System Architecture and Implementation

Database System Architecture and Implementation Kristin Tufte Execution Costs 1 Web Forms Orientation Applications SQL Interface SQL Commands Executor Operator Evaluator Parser Optimizer DBMS Transaction

### Chapter 2 Memory Management: Early Systems. Understanding Operating Systems, Fourth Edition

Chapter 2 Memory Management: Early Systems Understanding Operating Systems, Fourth Edition Memory Management: Early Systems Memory is second only to processes in importance (and in intensity) with which

### 5. A full binary tree with n leaves contains [A] n nodes. [B] log n 2 nodes. [C] 2n 1 nodes. [D] n 2 nodes.

1. The advantage of.. is that they solve the problem if sequential storage representation. But disadvantage in that is they are sequential lists. [A] Lists [B] Linked Lists [A] Trees [A] Queues 2. The

### Chapter 13 File and Database Systems

Chapter 13 File and Database Systems Outline 13.1 Introduction 13.2 Data Hierarchy 13.3 Files 13.4 File Systems 13.4.1 Directories 13.4. Metadata 13.4. Mounting 13.5 File Organization 13.6 File Allocation

### Chapter 13 File and Database Systems

Chapter 13 File and Database Systems Outline 13.1 Introduction 13.2 Data Hierarchy 13.3 Files 13.4 File Systems 13.4.1 Directories 13.4. Metadata 13.4. Mounting 13.5 File Organization 13.6 File Allocation

Universidad Carlos III de Madrid Algorithms and Data Structures (ADS) Bachelor in Informatics Engineering Computer Science Department Binary Search Trees. Authors: Julian Moreno Schneider Isabel Segura-Bedmar

### International Journal of Advanced Research in Computer Science and Software Engineering

Volume 3, Issue 7, July 23 ISSN: 2277 28X International Journal of Advanced Research in Computer Science and Software Engineering Research Paper Available online at: www.ijarcsse.com Greedy Algorithm:

### Searching & Sorting. Searching & Sorting 1

Searching & Sorting Searching & Sorting 1 The Plan Searching Sorting Java Context Searching & Sorting 2 Search (Retrieval) Looking it up One of most fundamental operations Without computer Indexes Tables