Lecture 19 - ECE 2574 Introduction to Data Structures and...

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

View Full Document Right Arrow Icon
ECE 2574 Introduction to Data Structures and Algorithms Lecture 19: Binary Search Trees Chris Wyatt Electrical and Computer Engineering and School of Biomedical Engineering and Sciences Virginia Tech
Image of page 1

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

View Full Document Right Arrow Icon
Announcements Exam 2 is Wednesday April 2nd. Open Book, Open Notes Cumulative but will focus on material since Exam 1 We will do a quick review on Monday.
Image of page 2
Recall the binary search algorithm using a sorted list.
Image of page 3

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

View Full Document Right Arrow Icon
We can represent the sorted list using a binary tree with a speci fi c relationship among the nodes.
Image of page 4
This leads to the Binary Search Tree ADT. We can map the sorted list operations onto the binary search tree. Because the insert and delete can use the binary structure, they are more ef fi cient. Better than binary search on a pointer-based (linked) list.
Image of page 5

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

View Full Document Right Arrow Icon
Binary Search Tree (BST) Operations Consider the items of type TreeItemType to have an associated key of keyType. // create an empty BST +createBST() // destroy a BST +destroyBST() // check if a BST is empty +isEmpty(): bool
Image of page 6
Binary Search Tree (BST) Operations
Image of page 7

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

View Full Document Right Arrow Icon
Image of page 8
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