# CSCI 104 Tries. Mark Redekopp David Kempe

Save this PDF as:

Size: px
Start display at page:

Download "CSCI 104 Tries. Mark Redekopp David Kempe"

## Transcription

1 1 CSCI 104 Tries Mark Redekopp David Kempe

2 TRIES 2

3 3 Review of Set/Map Again Recall the operations a set or map performs Insert(key) Remove(key) find(key) : bool/iterator/pointer Get(key) : value [Map only] We can implement a set or map using a binary search tree Search = O( ) But what work do we have to do at each node? Compare (i.e. string compare) How much does that cost? Int = O(1) String = O( m ) where m is length of the string Thus, search costs O( ) "hear" "help" "ill" "heap" "help" "in"

4 4 Review of Set/Map Again Recall the operations a set or map performs Insert(key) Remove(key) find(key) : bool/iterator/pointer Get(key) : value [Map only] We can implement a set or map using a binary search tree Search = O( log(n) ) But what work do we have to do at each node? Compare (i.e. string compare) How much does that cost? Int = O(1) String = O( m ) where m is length of the string Thus, search costs O( m * log(n) ) "hear" "help" "ill" "heap" "help" "in"

5 5 Review of Set/Map Again We can implement a set or map using a hash table Search = O( 1 ) But what work do we have to do once we hash? Compare (i.e. string compare) How much does that cost? Int = O(1) String = O( m ) where m is length of the string Thus, search costs O( m ) "help" Conversion function healhelp ill hear 3.45

6 6 Tries Assuming unique keys, can we still achieve O(m) search but not have collisions? H - I O(m) means the time to compare is independent of how many keys (i.e. n) are being stored and only depends on the length of the key E E H I N N Trie(s) (often pronounced "try" or "tries") allow O(m) retrieval A A Sometimes referred to as a radix tree or prefix tree Consider a trie for the keys P R P P R P "HE", "HEAP", "HEAR", "HEP", "I", "IN"

7 7 Tries Rather than each node storing a full key value, each node represents a prefix of the key Highlighted nodes indicate terminal locations For a map we could store the associated value of the key at that terminal location E E H H - I I N N Notice we "share" paths for keys that have a common prefix A A To search for a key, start at the root consuming one unit (bit, char, etc.) of the key at a time P R P P R P If you end at a terminal node, SUCCESS If you end at a non-terminal node, FAIURE

8 8 Tries To search for a key, start at the root consuming one unit (bit, char, etc.) of the key at a time If you end at a terminal node, SUCCESS If you end at a non-terminal node, FAIURE Examples: Search for "He" Search for "Help" Search for "Head" E A E A H H - I I N N Search takes O(m) where m = length of key P R P P R P Notice this is the same as a hash table A "value" type could be stored for each non-terminal node

9 9 Your Turn Construct a trie to store the set of words Ten Tent Then Tense Tens Tenth

10 10 Application: IP ookups Network routers form the backbone of the Internet Incoming packets contain a destination IP address ( ) Routers contain a "routing table" mapping some prefix of destination IP address to output port x.x => Output port C x => Output port B 128.x.x.x => Output port D 132.x.x.x => Output port A Keys = Match the longest prefix Keys are unique Value = Output port Octet 1 Octet 2 Octet 3 Port C B D A

11 11 IP ookup Trie A binary trie implies that the eft child is for bit '0' Right child is for bit '1' Routing Table: x.x => Output port C x => Output port B x => Output port D 132.x.x.x => Output port A Octet 1 Octet 2 Octet 3 Port C B D A D A C B 0 0

12 12 Structure of Trie Nodes What do we need to store in each node? Depends on how "dense" or "sparse" the tree is? Dense (most characters used) or small size of alphabet of possible key characters Array of child pointers One for each possible character in the alphabet Sparse (inked) ist of children Node needs to store template < class V > struct TrieNode{ V* value; // NU if non-terminal TrieNode<V>* children[26]; }; a V* template < class V > struct TrieNode{ char key; V* value; TrieNode<V>* next; TrieNode<V>* children; }; h c r c b f f s z s h r

13 13 Search consumes one character at a time until The end of the search key If value pointer exists, then the key is present in the map Or no child pointer exists in the TrieNode Insert Search until key is consumed but trie path already exists Set v pointer to value Search until trie path is NU, extend path adding new TrieNodes and then add value at terminal Search V* search(char* k, TrieNode<V>* node) { while(*k!= '\0' && node!= NU){ node = node->children[*k 'a']; k++; } if(node){ return node->v; } } void insert(char* k, Value& v) { TrieNode<V>* node = root; while(*k!= '\0' && node!= NU){ node = node->children[*k 'a']; k++; } if(node){ node->v = new Value(v); } else { // create new nodes in trie // to extend path // updating root if trie is empty } }

14 SUFFIX TREES (TRIES) 14

15 15 Prefix Trees (Tries) Review What problem does a prefix tree solve ookups of keys (and possible associated values) A prefix tree helps us match 1-of-n keys "He" "Help" "Hear" "Heap" "In" "Ill" Here is a slightly different problem: Given a large text string, T, can we find certain substrings or answer other queries about patterns in T A suffix tree (trie) can help here

16 16 Suffix Trie Slides

17 17 Suffix Trie Wrap-Up How many nodes can a suffix trie have for text, T, with length T? T 2 Can we do better? Can compress paths without branches into a single node Do we need a suffix trie to find substrings or answer certain queries? We could just take a string and search it for a certain query, q But it would be slow => O( T ) and not O( q )

18 18 What Have We earned [Key Point]: Think about all the data structures we've been learning? There is almost always a trade-off of memory vs. speed i.e. Space vs. time Most data structures just exploit different points on that time-space tradeoff continuum Think about searches in your project Do we need a map? No, we could just search all items each time a keyword is provided But think how slow that would be So we build a data structure (i.e. a map) that replicates data and takes a lot of memory space so that we can find data faster

### Chapter 12 Digital Search Structures

Chapter Digital Search Structures Digital Search Trees Binary Tries and Patricia Multiway Tries C-C Tsai P. Digital Search Tree A digital search tree is a binary tree in which each node contains one element.

### ECE697AA Lecture 20. Forwarding Tables

ECE697AA Lecture 20 Routers: Prefix Lookup Algorithms Tilman Wolf Department of Electrical and Computer Engineering 11/14/08 Forwarding Tables Routing protocols involve a lot of information Path choices,

### Data Structures and Algorithms Dr. Naveen Garg Department of Computer Science and Engineering Indian Institute of Technology, Delhi.

Data Structures and Algorithms Dr. Naveen Garg Department of Computer Science and Engineering Indian Institute of Technology, Delhi Lecture 18 Tries Today we are going to be talking about another data

### COMP4128 Programming Challenges

Multi- COMP4128 Programming Challenges School of Computer Science and Engineering UNSW Australia Table of Contents 2 Multi- 1 2 Multi- 3 3 Multi- Given two strings, a text T and a pattern P, find the first

### Chapter 20: Binary Trees

Chapter 20: Binary Trees 20.1 Definition and Application of Binary Trees Definition and Application of Binary Trees Binary tree: a nonlinear linked list in which each node may point to 0, 1, or two other

### CS 268: Route Lookup and Packet Classification

Overview CS 268: Route Lookup and Packet Classification Packet Lookup Packet Classification Ion Stoica March 3, 24 istoica@cs.berkeley.edu 2 Lookup Problem Identify the output interface to forward an incoming

### Foundation Exam - Sample Problems for New Topics

Foundation Exam - Sample Problems for New Topics Fall 2016 Dynamic Memory Allocation Sample Question #1 Consider the following struct to store a single Uno playing card: typedef struct char color[20];

### Advances Data Structures (COP 5536) Spring 2015 Programming Project Report. Juthika Das UFID

Advances Data Structures (COP 5536) Spring 2015 Programming Project Report Juthika Das UFID 7173-5283 juthika@ufl.edu PROJECT DESCRIPTION The project consists of two parts. The first part is implementing

### CS 104 (Spring 2014) Final Exam 05/09/2014

CS 104 (Spring 2014) Final Exam 05/09/2014 G o o d L u c k Your Name, USC username, and Student ID: This exam has 8 pages and 8 questions. If yours does not, please contact us immediately. Please read

### Data Structure and Algorithm Homework #3 Due: 1:20pm, Thursday, May 16, 2017 TA === Homework submission instructions ===

Data Structure and Algorithm Homework #3 Due: 1:20pm, Thursday, May 16, 2017 TA email: dsa1@csie.ntu.edu.tw === Homework submission instructions === For Problem 1-3, please put all your solutions in a

### Figure 1. The Suffix Trie Representing "BANANAS".

The problem Fast String Searching With Suffix Trees: Tutorial by Mark Nelson http://marknelson.us/1996/08/01/suffix-trees/ Matching string sequences is a problem that computer programmers face on a regular

### Radix Searching. The insert procedure for digital search trees also derives directly from the corresponding procedure for binary search trees:

Radix Searching The most simple radix search method is digital tree searching - the binary search tree with the branch in the tree according to the bits of keys: at the first level the leading bit is used,

### Lecture Notes on Tries

Lecture Notes on Tries 15-122: Principles of Imperative Computation Thomas Cortina, Frank Pfenning, Rob Simmons, Penny Anderson Lecture 22 June 20, 2014 1 Introduction In the data structures implementing

### Computer Science Foundation Exam

Computer Science Foundation Exam August 26, 2017 Section I A DATA STRUCTURES NO books, notes, or calculators may be used, and you must work entirely on your own. Name: UCFID: NID: Question # Max Pts Category

### SORTING. Practical applications in computing require things to be in order. To consider: Runtime. Memory Space. Stability. In-place algorithms???

SORTING + STRING COMP 321 McGill University These slides are mainly compiled from the following resources. - Professor Jaehyun Park slides CS 97SI - Top-coder tutorials. - Programming Challenges book.

### Suffix Trees and Arrays

Suffix Trees and Arrays Yufei Tao KAIST May 1, 2013 We will discuss the following substring matching problem: Problem (Substring Matching) Let σ be a single string of n characters. Given a query string

### String Matching. Pedro Ribeiro 2016/2017 DCC/FCUP. Pedro Ribeiro (DCC/FCUP) String Matching 2016/ / 42

String Matching Pedro Ribeiro DCC/FCUP 2016/2017 Pedro Ribeiro (DCC/FCUP) String Matching 2016/2017 1 / 42 On this lecture The String Matching Problem Naive Algorithm Deterministic Finite Automata Knuth-Morris-Pratt

### CS106X Handout 35 Winter 2018 March 12 th, 2018 CS106X Midterm Examination

CS106X Handout 35 Winter 2018 March 12 th, 2018 CS106X Midterm Examination This is an open-book, open-note, closed-electronic-device exam. You needn t write #includes, and you may (and you re even encouraged

### Final Examination CSE 100 UCSD (Practice)

Final Examination UCSD (Practice) RULES: 1. Don t start the exam until the instructor says to. 2. This is a closed-book, closed-notes, no-calculator exam. Don t refer to any materials other than the exam

### CS/COE 1501 cs.pitt.edu/~bill/1501/ Searching

CS/COE 1501 cs.pitt.edu/~bill/1501/ Searching Review: Searching through a collection Given a collection of keys C, how to we search for a given key k? Store collection in an array Unsorted Sorted Linked

### An Introduction to Trees

An Introduction to Trees Alice E. Fischer Spring 2017 Alice E. Fischer An Introduction to Trees... 1/34 Spring 2017 1 / 34 Outline 1 Trees the Abstraction Definitions 2 Expression Trees 3 Binary Search

### Text search. CSE 392, Computers Playing Jeopardy!, Fall

Text search CSE 392, Computers Playing Jeopardy!, Fall 2011 Stony Brook University http://www.cs.stonybrook.edu/~cse392 1 Today 2 parts: theoretical: costs of searching substrings, data structures for

### Data structures for string pattern matching: Suffix trees

Suffix trees Data structures for string pattern matching: Suffix trees Linear algorithms for exact string matching KMP Z-value algorithm What is suffix tree? A tree-like data structure for solving problems

### CSE 2123 Recursion. Jeremy Morris

CSE 2123 Recursion Jeremy Morris 1 Past Few Weeks For the past few weeks we have been focusing on data structures Classes & Object-oriented programming Collections Lists, Sets, Maps, etc. Now we turn our

### Data Structures for Packet Classification

Presenter: Patrick Nicholson Department of Computer Science CS840 Topics in Data Structures Outline 1 The Problem 2 Hardware Solutions 3 Data Structures: 1D 4 Trie-Based Solutions Packet Classification

### CS106X Handout 39 Autumn 2012 November 28 th, 2012 CS106X Midterm Examination II

CS106X Handout 39 Autumn 2012 November 28 th, 2012 CS106X Midterm Examination II This is closed book, closed notes, closed reader, closed everything exam. If you re taking the exam remotely, you can telephone

### Tree: non-recursive definition. Trees, Binary Search Trees, and Heaps. Tree: recursive definition. Tree: example.

Trees, Binary Search Trees, and Heaps CS 5301 Fall 2013 Jill Seaman Tree: non-recursive definition Tree: set of nodes and directed edges - root: one node is distinguished as the root - Every node (except

### Efficient subset and superset queries

Efficient subset and superset queries Iztok SAVNIK Faculty of Mathematics, Natural Sciences and Information Technologies, University of Primorska, Glagoljaška 8, 5000 Koper, Slovenia Abstract. The paper

### Efficient Packet Classification using Splay Tree Models

28 IJCSNS International Journal of Computer Science and Network Security, VOL.6 No.5B, May 2006 Efficient Packet Classification using Splay Tree Models Srinivasan.T, Nivedita.M, Mahadevan.V Sri Venkateswara

### Implementing Dynamic Minimal-prefix Tries

SOFTWARE PRACTICE AND EXPERIENCE, VOL. 21(10), 1027 1040 (OCTOBER 1991) Implementing Dynamic Minimal-prefix Tries JOHN A. DUNDAS III Jet Propulsion Laboratory, California Institute of Technology, Mail

### Applied Databases. Sebastian Maneth. Lecture 14 Indexed String Search, Suffix Trees. University of Edinburgh - March 9th, 2017

Applied Databases Lecture 14 Indexed String Search, Suffix Trees Sebastian Maneth University of Edinburgh - March 9th, 2017 2 Recap: Morris-Pratt (1970) Given Pattern P, Text T, find all occurrences of

### CSCE 2014 Final Exam Spring Version A

CSCE 2014 Final Exam Spring 2017 Version A Student Name: Student UAID: Instructions: This is a two-hour exam. Students are allowed one 8.5 by 11 page of study notes. Calculators, cell phones and computers

### Introduction. Router Architectures. Introduction. Introduction. Recent advances in routing architecture including

Introduction Router Architectures Recent advances in routing architecture including specialized hardware switching fabrics efficient and faster lookup algorithms have created routers that are capable of

### Suffix-based text indices, construction algorithms, and applications.

Suffix-based text indices, construction algorithms, and applications. F. Franek Computing and Software McMaster University Hamilton, Ontario 2nd CanaDAM Conference Centre de recherches mathématiques in

### 15 July, Huffman Trees. Heaps

1 Huffman Trees The Huffman Code: Huffman algorithm uses a binary tree to compress data. It is called the Huffman code, after David Huffman who discovered d it in 1952. Data compression is important in

### Computer Science Foundation Exam

Computer Science Foundation Exam August 6, 017 Section I A DATA STRUCTURES SOLUTIONS NO books, notes, or calculators may be used, and you must work entirely on your own. Question # Max Pts Category Passing

### Consider the search operation FindKey (): find an element of a particular key value in a binary tree. This operation takes O(n) time in a binary

1 Consider the search operation FindKey (): find an element of a particular key value in a binary tree. This operation takes O(n) time in a binary tree. In a binary tree of 10 6 nodes 10 6 steps required

### Computer Science Foundation Exam

Computer Science Foundation Exam December 16, 2016 Section I A DATA STRUCTURES NO books, notes, or calculators may be used, and you must work entirely on your own. Name: UCFID: NID: Question # Max Pts

### Balanced Search Trees

Balanced Search Trees Computer Science E-22 Harvard Extension School David G. Sullivan, Ph.D. Review: Balanced Trees A tree is balanced if, for each node, the node s subtrees have the same height or have

### Lecture 7 February 26, 2010

6.85: Advanced Data Structures Spring Prof. Andre Schulz Lecture 7 February 6, Scribe: Mark Chen Overview In this lecture, we consider the string matching problem - finding all places in a text where some

### Priority Queues (Heaps)

Priority Queues (Heaps) 1 Priority Queues Many applications require that we process records with keys in order, but not necessarily in full sorted order. Often we collect a set of items and process the

### Lecture 11: Packet forwarding

Lecture 11: Packet forwarding Anirudh Sivaraman 2017/10/23 This week we ll talk about the data plane. Recall that the routing layer broadly consists of two parts: (1) the control plane that computes routes

### ECE697AA Lecture 21. Packet Classification

ECE697AA Lecture 21 Routers: Flow Classification Algorithms Tilman Wolf Department of Electrical and Computer Engineering 11/20/08 Packet Classification What is packet classification? Categorization of

### Graphs & Digraphs Tuesday, November 06, 2007

Graphs & Digraphs Tuesday, November 06, 2007 10:34 PM 16.1 Directed Graphs (digraphs) like a tree but w/ no root node & no guarantee of paths between nodes consists of: nodes/vertices - a set of elements

### University of Illinois at Urbana-Champaign Department of Computer Science. Second Examination

University of Illinois at Urbana-Champaign Department of Computer Science Second Examination CS 225 Data Structures and Software Principles Spring 2012 7p-9p, Tuesday, April 3 Name: NetID: Lab Section

### Chapter 8: Subnetting IP networks. Introduction to Networks v5.1

Chapter 8: Subnetting IP networks Introduction to Networks v5.1 8.0 Introduction 8.1 Subnetting an IPv4 Network 8.2 Addressing Schemes 8.3 Design Considerations for IPv6 8.4 Summary 2013 Cisco and/or its

### Indexing and Searching

Indexing and Searching Berlin Chen Department of Computer Science & Information Engineering National Taiwan Normal University References: 1. Modern Information Retrieval, chapter 8 2. Information Retrieval:

### CS 241 Data Organization Binary Trees

CS 241 Data Organization Binary Trees Brooke Chenoweth University of New Mexico Fall 2017 Binary Tree: Kernighan and Ritchie 6.5 Read a file and count the occurrences of each word. now is the time for

### Routing Lookup Algorithm for IPv6 using Hash Tables

Routing Lookup Algorithm for IPv6 using Hash Tables Peter Korppoey, John Smith, Department of Electronics Engineering, New Mexico State University-Main Campus Abstract: After analyzing of existing routing

### Winter 2018 March 12 th, 2018 CS106X Midterm Examination Solution

CS106X Handout 35S Winter 2018 March 12 th, 2018 CS106X Midterm Examination Solution Once again, your awesome course staff spent the week grading your exams, and I m happy to share that they re graded!

### Cpt S 223 Fall Cpt S 223. School of EECS, WSU

Course Review Cpt S 223 Fall 2012 1 Final Exam When: Monday (December 10) 8 10 AM Where: in class (Sloan 150) Closed book, closed notes Comprehensive Material for preparation: Lecture slides & class notes

### CMSC 341 Leftist Heaps

CMSC 341 Leftist Heaps Based on slides from previous iterations of this course Today s Topics Review of Min Heaps Introduction of Left-ist Heaps Merge Operation Heap Operations Review of Heaps Min Binary

### Draw the resulting binary search tree. Be sure to show intermediate steps for partial credit (in case your final tree is incorrect).

Problem 1. Binary Search Trees (36 points) a) (12 points) Assume that the following numbers are inserted into an (initially empty) binary search tree in the order shown below (from left to right): 42 36

### Course Review. Cpt S 223 Fall 2009

Course Review Cpt S 223 Fall 2009 1 Final Exam When: Tuesday (12/15) 8-10am Where: in class Closed book, closed notes Comprehensive Material for preparation: Lecture slides & class notes Homeworks & program

### Lecture Notes on Binary Search Trees

Lecture Notes on Binary Search Trees 15-122: Principles of Imperative Computation Frank Pfenning Lecture 17 1 Introduction In the previous two lectures we have seen how to exploit the structure of binary

### CSE 100 Advanced Data Structures

CSE 100 Advanced Data Structures Overview of course requirements Outline of CSE 100 topics Review of trees Helpful hints for team programming Information about computer accounts Page 1 of 25 CSE 100 web

### A set of nodes (or vertices) with a single starting point

Binary Search Trees Understand tree terminology Understand and implement tree traversals Define the binary search tree property Implement binary search trees Implement the TreeSort algorithm 2 A set of

### Lecture 5: Suffix Trees

Longest Common Substring Problem Lecture 5: Suffix Trees Given a text T = GGAGCTTAGAACT and a string P = ATTCGCTTAGCCTA, how do we find the longest common substring between them? Here the longest common

### Multi-way Search Trees! M-Way Search! M-Way Search Trees Representation!

Lecture 10: Multi-way Search Trees: intro to B-trees 2-3 trees 2-3-4 trees Multi-way Search Trees A node on an M-way search tree with M 1 distinct and ordered keys: k 1 < k 2 < k 3

### Application of TRIE data structure and corresponding associative algorithms for process optimization in GRID environment

Application of TRIE data structure and corresponding associative algorithms for process optimization in GRID environment V. V. Kashansky a, I. L. Kaftannikov b South Ural State University (National Research

### L02 : 08/21/2015 L03 : 08/24/2015.

L02 : 08/21/2015 http://www.csee.wvu.edu/~adjeroh/classes/cs493n/ Multimedia use to be the idea of Big Data Definition of Big Data is moving data (It will be different in 5..10 yrs). Big data is highly

### Tree Data Structures CSC 221

Tree Data Structures CSC 221 BSTree Deletion - Merging template // LOOK AT THIS PARAMETER!!! void BST::deleteByMerging(BSTNode* & nodepointer) { BSTNode* temp= nodepointer;

### Sorting and Selection

Sorting and Selection Introduction Divide and Conquer Merge-Sort Quick-Sort Radix-Sort Bucket-Sort 10-1 Introduction Assuming we have a sequence S storing a list of keyelement entries. The key of the element

### Second Examination Solution

University of Illinois at Urbana-Champaign Department of Computer Science Second Examination Solution CS 225 Data Structures and Software Principles Fall 2007 7p-9p, Thursday, November 8 Name: NetID: Lab

### CS419: Computer Networks. Lecture 6: March 7, 2005 Fast Address Lookup:

: Computer Networks Lecture 6: March 7, 2005 Fast Address Lookup: Forwarding/Routing Revisited Best-match Longest-prefix forwarding table lookup We looked at the semantics of bestmatch longest-prefix address

### Generic Architecture. EECS 122: Introduction to Computer Networks Switch and Router Architectures. Shared Memory (1 st Generation) Today s Lecture

Generic Architecture EECS : Introduction to Computer Networks Switch and Router Architectures Computer Science Division Department of Electrical Engineering and Computer Sciences University of California,

### Introduction To C#.NET

Introduction To C#.NET Microsoft.Net was formerly known as Next Generation Windows Services(NGWS).It is a completely new platform for developing the next generation of windows/web applications. However

### Dictionaries. Priority Queues

Red-Black-Trees.1 Dictionaries Sets and Multisets; Opers: (Ins., Del., Mem.) Sequential sorted or unsorted lists. Linked sorted or unsorted lists. Tries and Hash Tables. Binary Search Trees. Priority Queues

### List of groups known at each router. Router gets those using IGMP. And where they are in use Where members are located. Enhancement to OSPF

Multicast OSPF OSPF Open Shortest Path First Link State Protocol Use Dijkstra s algorithm (SPF) Calculate shortest path from the router to every possible destination Areas Limit the information volume

### CSC 421: Algorithm Design & Analysis. Spring Space vs. time

CSC 421: Algorithm Design & Analysis Spring 2015 Space vs. time space/time tradeoffs examples: heap sort, data structure redundancy, hashing string matching brute force, Horspool algorithm, Boyer-Moore

### SERIOUS ABOUT SOFTWARE. Qt Core features. Timo Strömmer, May 26,

SERIOUS ABOUT SOFTWARE Qt Core features Timo Strömmer, May 26, 2010 1 Contents C++ refresher Core features Object model Signals & slots Event loop Shared data Strings Containers Private implementation

### Outline. An Application: A Binary Search Tree. 1 Chapter 7: Trees. favicon. CSI33 Data Structures

Outline Chapter 7: Trees 1 Chapter 7: Trees Approaching BST Making a decision We discussed the trade-offs between linked and array-based implementations of sequences (back in Section 4.7). Linked lists

### 58093 String Processing Algorithms. Lectures, Autumn 2013, period II

58093 String Processing Algorithms Lectures, Autumn 2013, period II Juha Kärkkäinen 1 Contents 0. Introduction 1. Sets of strings Search trees, string sorting, binary search 2. Exact string matching Finding

### MLR Institute of Technology

MLR Institute of Technology Laxma Reddy Avenue, Dundigal, Quthbullapur (M), Hyderabad 500 043 Phone Nos: 08418 204066 / 204088, Fax : 08418 204088 TUTORIAL QUESTION BANK Course Name : DATA STRUCTURES Course

### Crit-bit Trees. Adam Langley (Version )

CRITBIT CWEB OUTPUT 1 Crit-bit Trees Adam Langley (agl@imperialviolet.org) (Version 20080926) 1. Introduction This code is taken from Dan Bernstein s qhasm and implements a binary crit-bit (alsa known

### BINARY HEAP cs2420 Introduction to Algorithms and Data Structures Spring 2015

BINARY HEAP cs2420 Introduction to Algorithms and Data Structures Spring 2015 1 administrivia 2 -assignment 10 is due on Thursday -midterm grades out tomorrow 3 last time 4 -a hash table is a general storage

### TREES. Trees - Introduction

TREES Chapter 6 Trees - Introduction All previous data organizations we've studied are linear each element can have only one predecessor and successor Accessing all elements in a linear sequence is O(n)

### Predecessor. Predecessor. Predecessors. Predecessors. Predecessor Problem van Emde Boas Tries. Predecessor Problem van Emde Boas Tries.

Philip Bille s problem. Maintain a set S U = {,..., u-} supporting predecessor(x): return the largest element in S that is x. sucessor(x): return the smallest element in S that is x. insert(x): set S =

### Lecture L16 April 19, 2012

6.851: Advanced Data Structures Spring 2012 Prof. Erik Demaine Lecture L16 April 19, 2012 1 Overview In this lecture, we consider the string matching problem - finding some or all places in a text where

### Indexing. Chapter 8, 10, 11. Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1

Indexing Chapter 8, 10, 11 Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Tree-Based Indexing The data entries are arranged in sorted order by search key value. A hierarchical search

### CSE100. Advanced Data Structures. Lecture 12. (Based on Paul Kube course materials)

CSE100 Advanced Data Structures Lecture 12 (Based on Paul Kube course materials) CSE 100 Coding and decoding with a Huffman coding tree Huffman coding tree implementation issues Priority queues and priority

### Binary Heaps in Dynamic Arrays

Yufei Tao ITEE University of Queensland We have already learned that the binary heap serves as an efficient implementation of a priority queue. Our previous discussion was based on pointers (for getting

### EECS 122: Introduction to Computer Networks Switch and Router Architectures. Today s Lecture

EECS : Introduction to Computer Networks Switch and Router Architectures Computer Science Division Department of Electrical Engineering and Computer Sciences University of California, Berkeley Berkeley,

### CS/COE 1501

CS/COE 1501 www.cs.pitt.edu/~nlf4/cs1501/ Compression What is compression? Represent the same data using less storage space Can get more use out a disk of a given size Can get more use out of memory E.g.,

### CS 5010 Program Design Paradigms Lesson 6.1

Lists vs. Structures CS 5010 Program Design Paradigms Lesson 6.1 Mitchell Wand, 2012-2016 This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License. 1 Module Introduction

### Review on Tries for IPv6 Lookups

Available online www.ejaet.com European Journal of Advances in Engineering and Technology, 2016, 3(7): 28-33 Review Article ISSN: 2394-658X Review on Tries for IPv6 Lookups Rohit G Bal Department of Computer

### CP2 Revision. theme: dynamic datatypes & data structures

CP2 Revision theme: dynamic datatypes & data structures structs can hold any combination of datatypes handled as single entity struct { }; ;

### File Structures and Indexing

File Structures and Indexing CPS352: Database Systems Simon Miner Gordon College Last Revised: 10/11/12 Agenda Check-in Database File Structures Indexing Database Design Tips Check-in Database File Structures

### Chapter 12: Indexing and Hashing

Chapter 12: Indexing and Hashing Basic Concepts Ordered Indices B+-Tree Index Files B-Tree Index Files Static Hashing Dynamic Hashing Comparison of Ordered Indexing and Hashing Index Definition in SQL

### An introduction to suffix trees and indexing

An introduction to suffix trees and indexing Tomáš Flouri Solon P. Pissis Heidelberg Institute for Theoretical Studies December 3, 2012 1 Introduction Introduction 2 Basic Definitions Graph theory Alphabet

### CSCI-1200 Data Structures Test 3 Practice Problem Solutions

1 Short Answer [ /21] CSCI-1200 Data Structures Test 3 Practice Problem Solutions 1.1 TreeNode Parent Pointers [ /5] In our initial version of the ds set class, the TreeNode object had 3 member variables:

### Data Structure Chapter 6

ata Structure hapter Non-inary Trees r. Patrick han School of omputer Science and ngineering South hina University of Technology Outline Non-inary (eneral) Tree (h.) Parent Pointer mplementation (h.) ist

### SUMMARY OF DATABASE STORAGE AND QUERYING

SUMMARY OF DATABASE STORAGE AND QUERYING 1. Why Is It Important? Usually users of a database do not have to care the issues on this level. Actually, they should focus more on the logical model of a database

### Association Rule Mining: FP-Growth

Yufei Tao Department of Computer Science and Engineering Chinese University of Hong Kong We have already learned the Apriori algorithm for association rule mining. In this lecture, we will discuss a faster

### Programming Languages and Techniques (CIS120)

Programming Languages and Techniques () Lecture 6 January 24, 2018 Binary Search Trees (Lecture notes Chapter 7) Announcements Homework 2: Computing Human Evolution due Tuesday, September 19 th Reading:

### Lecture 5 Using Data Structures to Improve Dijkstra s Algorithm. (AM&O Sections and Appendix A)

Lecture Using Data Structures to Improve Dijkstra s Algorithm (AM&O Sections 4.6 4.8 and Appendix A) Manipulating the Data in Dijkstra s Algorithm The bottleneck operation in Dijkstra s Algorithm is that

### CMSC 341 Lecture 14: Priority Queues, Heaps

CMSC 341 Lecture 14: Priority Queues, Heaps Prof. John Park Based on slides from previous iterations of this course Today s Topics Priority Queues Abstract Data Type Implementations of Priority Queues:

### Efficient IP-Address Lookup with a Shared Forwarding Table for Multiple Virtual Routers

Efficient IP-Address Lookup with a Shared Forwarding Table for Multiple Virtual Routers ABSTRACT Jing Fu KTH, Royal Institute of Technology Stockholm, Sweden jing@kth.se Virtual routers are a promising