Lecture08 - Basics of Trees EECS 233 Hierarchies Everywhere...

Info icon This preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
Basics of Trees EECS 233
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
-2- Hierarchies Everywhere Your local directory structure Governmental and organizational structures General approach of dealing with large-scale computer systems Kazaa P2P network (peers and superpeers) Gnutella 2 Hostnames IP addresses Internet Autonomous systems OSPF areas Trees are natural representation of hierarchies
Image of page 2
-3- 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, efficiency = O (n). Various tree structures allow for a more efficient data dictionary. O (n), (O(1) to do the actual insertion, but O (n) to find 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 structure
Image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
-4- 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 fields key field = the field used when searching for a data item The node at the “top” of the tree is called the root of the tree.
Image of page 4
-5- Relationships Between Nodes If a node N is connected to other nodes that are directly below it in the tree, N
Image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern