=========================================================================== CSC 263H Tutorial Outline for Week 5 Winter 2004 =========================================================================== -------------------------- Augmenting data structures -------------------------- Example 1: - How do we compute MIN (return the smallest key stored in the tree) for a 2-3-4 tree? - What's the running time for MIN? - What if we need to carry out this operations very often? Can we make it faster without affecting the other operations? - What additional information could we store to help? - Given this extra information, what's the running time of MIN? - Do we have to change SEARCH to maintain this new information? How would you change it, and what would be its new running time? - Do we have to change INSERT to maintain this new information? How would you change it, and what would be its new running time? - Do we have to change DELETE to maintain this new information? How would you change it, and what would be its new running time? Example 2: - What if we want to answer queries MIN(x): return the smallest key in the subtree rooted at node x, for abitrary nodes x in a 2-3-4 tree (not just for the root)? - What additional information could we store to help? - Given this extra information, what's the running time of MIN(x)? - Do we have to change SEARCH to maintain this new information? How would you change it, and what would be its new running time? - Do we have to change INSERT to maintain this new information? How would you change it, and what would be its new running time? - Do we have to change DELETE to maintain this new information? How would you change it, and what would be its new running time?