This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Basics of Trees EECS 2332 Hierarchies Everywhere Your local directory structure Governmental and organizational structures General approach of dealing with largescale computer systems Kazaa P2P network (peers and superpeers) Gnutella 2 Hostnames IP addresses Internet Autonomous systems OSPF areas Trees are natural representation of hierarchies3 Mundane Example: Maintaining a Sorted Collection of Data A data dictionary is a sorted collection of data with the following key operations: search for an item (and possibly delete it) insert a new item If we use a list (in previous lectures) to implement a data dictionary, efFciency = O (n). Various tree structures allow for a more efFcient data dictionary. O (n), (O(1) to do the actual insertion, but O (n) to Fnd the right spot) O (n) using linear search a list implemented using a linked list O (n) because we need to shift items over O (log n) using binary search a list implemented using an array (sorted) inserting an item searching for an item data structure4 What Is A Tree? A tree consists of: a set of nodes, with one of them distinguished as a root a set of edges , each of which connects a pair of nodes no cycles Each node may have an associated data item (“payload”). consists of one or more Felds key feld = the Feld used when searching for a data item The node at the “top” of the tree is called the root of the tree.5 Relationships Between Nodes If a node N is connected to other nodes that are directly below it in the tree, N is referred to as their...
View
Full
Document
This note was uploaded on 04/07/2008 for the course EECS 233 taught by Professor Rabinovich during the Spring '08 term at Case Western.
 Spring '08
 Rabinovich

Click to edit the document details