Algorithm Analysis (CSC 301 2015F) : EBoards
Primary: [Front Door] [Schedule] - [Academic Honesty] [Disabilities] [Email] [FAQ] [IRC] [Teaching & Learning]
Current: [Outline] [EBoard] [Reading] [Lab] [Assignment]
Sections: [Assignments] [EBoards] [Examples] [Handouts] [Labs] [Outlines] [Readings]
Reference: [Algorist]
Related Courses: [Walker (2014F)]
Misc: [SamR] [Glimmer Labs] [CS@Grinnell] [Grinnell] [Issue Tracker]
Overview
Idea 1: If we insert in the two-element left subtree of a singleton node, move the largest value in the left subtree up, and move the value in the right subtree down
Idea 2: Move the center value value up, split the node, and cross your fingers.
We will pursue idea 2
Example
(8)
/ \
(2 5) (17)
Insert 7
(5 8)
/ | \
(2) (7) (17)
Task
(8 12)
/ | \
(2 5) (10) (17)
Assume we insert 4
(4 8 12)
/ | \
(2) (5) (10) (17)
Pop the middle one up and split it
(8)
/ \
(4) (12)
/ \ / \
(2) (5) (10) (17)
Deletion in 2-3 Trees
(8)
/ \
(4) (12)
/ \ / \
(2) (5) (10) (17 21)
Generalized 2-3 trees min # values in a node and a maximum number (m-n)
Idea: The nodes in the tree are stored on disk, so we have 1K or more per node. We might as well make use of it. So ... array of values and links to other disk blocks