rec03 - 6.006 Intro to Algorithms Recitation 03 February 9,...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 6.006 Intro to Algorithms Recitation 03 February 9, 2011 Binary Search Tree A binary search tree is a data structure that allows for key lookup, insertion, and deletion. It is a binary tree, meaning every node of the tree has at most two child nodes, a left child and a right child. Each node of the tree holds the following information: x .key - Value stored in node x x .left- Pointer to the left child of node x . NIL if x has no left child x .right - Pointer to the right child of node x . NIL if x has no right child x .parent - Pointer to the parent node of node x . NIL if x has no parent, i.e. x is the root of the tree Later on this week, we will learn about binary search trees that holds data in addition to the four listed above but for now we will focus on the vanilla binary search tree. A binary search tree has two simple properties: For each node x , every value found in the left subtree of x is less than or equal to the value found in x For each node x , every value found in the right subtree of x is greater than or equal to the value found in x 6.006 Intro to Algorithms Recitation 03 February 9, 2011 BST Operations There are operations of a binary search tree that take advantage of the properties above to search for keys. There are other operations that manipulate the tree to insert new key or remove old onesfor keys....
View Full Document

This note was uploaded on 11/11/2011 for the course MATH 180 taught by Professor Byrns during the Spring '11 term at Montgomery College.

Page1 / 6

rec03 - 6.006 Intro to Algorithms Recitation 03 February 9,...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online