Digital Search Trees & Binary Tries Analog of radix sort to searching. Keys are binary bit strings.  Fixed length – 0110, 0010, 1010, 1011.  Variable.

Slides:



Advertisements
Similar presentations
Splay Trees Binary search trees.
Advertisements

Router/Classifier/Firewall Tables Set of rules—(F,A)  F is a filter Source and destination addresses. Port number and protocol. Time of day.  A is an.
Internet Routers
IP Addressing Introductory material.
An On-Chip IP Address Lookup Algorithm Author: Xuehong Sun and Yiqiang Q. Zhao Publisher: IEEE TRANSACTIONS ON COMPUTERS, 2005 Presenter: Yu Hao, Tseng.
Binary Tries (continued) split(k). Similar to split algorithm for unbalanced binary search trees. Construct S and B on way down the trie. Follow with a.
M. Waldvogel, G. Varghese, J. Turner, B. Plattner Presenter: Shulin You UNIVERSITY OF MASSACHUSETTS, AMHERST – Department of Electrical and Computer Engineering.
IP Routing Lookups Scalable High Speed IP Routing Lookups.
Binary Search Trees Definition Of Binary Search Tree A binary tree. Each node has a (key, value) pair. For every node x, all keys in the left subtree.
Binary Trees, Binary Search Trees CMPS 2133 Spring 2008.
Binary Trees, Binary Search Trees COMP171 Fall 2006.
1 Suffix Trees and Suffix Arrays Modern Information Retrieval by R. Baeza-Yates and B. Ribeiro-Neto Addison-Wesley, (Chapter 8)
Tries Standard Tries Compressed Tries Suffix Tries.
1 Author: Ioannis Sourdis, Sri Harsha Katamaneni Publisher: IEEE ASAP,2011 Presenter: Jia-Wei Yo Date: 2011/11/16 Longest prefix Match and Updates in Range.
Prepared By: Eng.Ola M. Abd El-Latif
A supernetwork.
IP Address Lookup for Internet Routers Using Balanced Binary Search with Prefix Vector Author: Hyesook Lim, Hyeong-gee Kim, Changhoon Publisher: IEEE TRANSACTIONS.
Data Structures: Trees i206 Fall 2010 John Chuang Some slides adapted from Marti Hearst, Brian Hayes, or Glenn Brookshear.
Higher Order Tries Key = Social Security Number.   9 decimal digits. 10-way trie (order 10 trie) Height
Binary Search Trees1 Part-F1 Binary Search Trees   
Binary Search Trees Dictionary Operations:  IsEmpty()  Search(key)  Insert(key, value)  Delete(key)
Digital Search Trees & Binary Tries Analog of radix sort to searching. Keys are binary bit strings.  Fixed length – 0110, 0010, 1010,  Variable.
Searching with Structured Keys Objectives
Patricia P ractical A lgorithm T o R etrieve I nformation C oded I n A lphanumeric. Compressed binary trie. All nodes are of the same data type (binary.
Binomial Heaps. Min Binomial Heap Collection of min trees
1 A Fast IP Lookup Scheme for Longest-Matching Prefix Authors: Lih-Chyau Wuu, Shou-Yu Pin Reporter: Chen-Nien Tsai.
Basic Data Structures for IP lookups and Packet Classification
COMP 171 Data Structures and Algorithms Tutorial 10 Hash Tables.
Data Structures & Algorithms Radix Search Richard Newman based on slides by S. Sahni and book by R. Sedgewick.
Fast binary and multiway prefix searches for pachet forwarding Author: Yeim-Kuan Chang Publisher: COMPUTER NETWORKS, Volume 51, Issue 3, pp , February.
Address Lookup in IP Routers. 2 Routing Table Lookup Routing Decision Forwarding Decision Forwarding Decision Routing Table Routing Table Routing Table.
Binary Search Trees CSE, POSTECH. Search Trees Search trees are ideal for implementing dictionaries – Similar or better performance than skip lists and.
IP Addressing and Network Software. IP Addressing  A computer somewhere in the world needs to communicate with another computer somewhere else in the.
Binary Trees, Binary Search Trees RIZWAN REHMAN CENTRE FOR COMPUTER STUDIES DIBRUGARH UNIVERSITY.
B + -Trees Same structure as B-trees. Dictionary pairs are in leaves only. Leaves form a doubly-linked list. Remaining nodes have following structure:
Lecture 12 : Trie Data Structure Bong-Soo Sohn Assistant Professor School of Computer Science and Engineering Chung-Ang University.
Higher Order Tries Key = Social Security Number.   9 decimal digits. 10-way trie (order 10 trie) Height
Network Layer4-1 Datagram networks r no call setup at network layer r routers: no state about end-to-end connections m no network-level concept of “connection”
Scalable High Speed IP Routing Lookups Scalable High Speed IP Routing Lookups Authors: M. Waldvogel, G. Varghese, J. Turner, B. Plattner Presenter: Zhqi.
Segment Trees Basic data structure in computational geometry. Computational geometry.  Computations with geometric objects.  Points in 1-, 2-, 3-, d-space.
Topics Definition and Application of Binary Trees Binary Search Tree Operations.
Sets of Digital Data CSCI 2720 Fall 2005 Kraemer.
Data Structure II. Outline Heap Binary Search Tree Hash Table Binary Indexed Tree Segment Tree.
CS 740: Advanced Computer Networks IP Lookup and classification Supplemental material 02/05/2007.
Binary Search Trees Lecture 5 1. Binary search tree sort 2.
Binary Search Trees (BSTs) 18 February Binary Search Tree (BST) An important special kind of binary tree is the BST Each node stores some information.
Binary Search Trees Dictionary Operations:  search(key)  insert(key, value)  delete(key) Additional operations:  ascend()  IndexSearch(index) (indexed.
[Algo] MCPE CMU. Member Group Present 1.SUTTICHAI MESAARD SURIYA KONCHAIYAPHOM NATTHAWOOT PUNROOB WIWAT TAWEESUP
Ofir Luzon Supervisor: Prof. Michael Segal Longest Prefix Match For IP Lookup.
Top 50 Data Structures Interview Questions
Higher Order Tries Key = Social Security Number.
Data Structure Interview Question and Answers
IP Routers – internal view
Binary search tree. Removing a node
Chapter-5 TCP/IP Suite.
Mark Redekopp David Kempe
Splay Trees Binary search trees.
Binary Search Tree Chapter 10.
Digital Search Trees & Binary Tries
Splay Trees Binary search trees.
Patricia Practical Algorithm To Retrieve Information Coded In Alphanumeric. Compressed binary trie. All nodes are of the same data type (binary tries use.
Binary Trees, Binary Search Trees
Binary Lesson 5 Classful IP Addresses
Binary Tries (continued)
Segment Trees Basic data structure in computational geometry.
Digital Search Trees & Binary Tries
Higher Order Tries Key = Social Security Number.
Binary Trees, Binary Search Trees
Binary Trees, Binary Search Trees
Presentation transcript:

Digital Search Trees & Binary Tries Analog of radix sort to searching. Keys are binary bit strings.  Fixed length – 0110, 0010, 1010,  Variable length – 01, 00, 101, Application – IP routing.  IPv4 – 32 bit IP address.  IPv6 – 128 bit IP address.

IPv4 Addresses 32-bit address divided into four 8-bit segments.  a1.a2.a3.a4  Each 8-bit segment is written as a decimal number in the range 0 – 255.   Class A Internet address.  a1 is net address.  Most significant bit of a1 is 0.  a2.a3.a4 gives host address within network.  <= 128 Class A nets.  Each Class A net may have up to 2 24 ~ 17 million hosts.

IPv4 Addresses  Class B Internet address.  a1.a2 is net address.  Two most significant bits are 10.  a3.a4 gives host address within network.  Up to 2 14 = 16,384 Class B nets.  Each Class B net may have up to 2 16 = 65,536 hosts.  IP addresses in a small company/department that has up to 256 hosts could have the format a1.a2.a3.*.  IP addresses of hosts in the same network/subnetwork have the same prefix.

IPv4 Routers Routing table entry … (prefix, nextMachine)  Prefix is a binary string whose length is <= 32 bits.  Packets whose destination address matches prefix may be routed to nextMachine.  (011*, M1) => all packets whose destination address begins with 011 may be routed next to machine M1.  ( *, M2)  Packet routing requires us to find the longest prefix (in the routing table) that matches the packet destination.

IP Router Table Collection of (prefix, nextMachine) pairs. Operations.  Add a pair.  Remove a pair.  Find pair with longest matching prefix.

Digital Search Tree Assume fixed number of bits. Not empty =>  Root contains one dictionary pair (any pair).  All remaining pairs whose key begins with a 0 are in the left subtree.  All remaining pairs whose key begins with a 1 are in the right subtree.  Left and right subtrees are digital subtrees on remaining bits.

Example Start with an empty digital search tree and insert a pair whose key is Now, insert a pair whose key is

Example Now, insert a pair whose key is

Example Now, insert a pair whose key is

Example Now, insert a pair whose key is

Search/Insert/Delete Complexity of each operation is O(#bits in a key). #key comparisons = O(height). Expensive when keys are very long

Binary Trie Information Retrieval. At most one key comparison per operation. Fixed length keys.  Branch nodes.  Left and right child pointers.  No data field(s).  Element nodes.  No child pointers.  Data field to hold dictionary pair.

Example At most one key comparison for a search

Variable Key Length Left and right child fields. Left and right pair fields.  Left pair is pair whose key terminates at root of left subtree or the single pair that might otherwise be in the left subtree.  Right pair is pair whose key terminates at root of right subtree or the single pair that might otherwise be in the right subtree.  Field is null otherwise.

Example At most one key comparison for a search null

Fixed Length Insert Insert Zero compares.

Fixed Length Insert Insert

Fixed Length Insert Insert

Fixed Length Insert Insert One compare

Fixed Length Delete Delete

Fixed Length Delete Delete 0111.One compare

Fixed Length Delete Delete

Fixed Length Delete Delete

Fixed Length Delete Delete

Fixed Length Delete Delete

Fixed Length Delete Delete 1100.One compare

Fixed Length Join(S,m,B) Insert m into B to get B’. S empty => B’ is answer; done. If you get to this step, the root of both S and B’ is a branch node. S is element node => insert S element into B’; done; B’ is element node => insert B’ element into S; done;

Fixed Length Join(S,m,B) S has empty right subtree. a S bc B’ c J(S,B’) J(a,b) J(X,Y)  join X and Y, all keys in X < all in Y.

Fixed Length Join(S,m,B) S has nonempty right subtree. Left subtree of B’ must be empty, because all keys in B’ > all keys in S. c B’ a J(S,B’) J(b,c) a S b Complexity = O(height).