mway7 - Advanced Tree Structures Multi-way Trees (7)...

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

View Full Document Right Arrow Icon
Introduction General trees are commonly referred to as multi-way trees. If there is a maximum value m placed on the number of children that a given node may have the tree is referred to as an m-way tree . There are many variations of m- way trees , however, we will focus on the special variant suitable for search- based applications. This variant is called the m-way search tree . M-way search trees play the same role amongst general trees that binary search trees play among binary trees, and they are used for exactly the same purpose: fast information retrieval and update. The problems in dealing with m- way search trees are similar to those experienced with BSTs. Balancing problems are more critical in general trees since there is a potential for many subtrees. Figure 1 presents an example of an m-way search tree, this one happens to be a 4-way search tree. Figure 2 provides a second example which is that of a 7-way search tree. In the m-way trees illustrated in Figures 1 and 2, the external nodes are not shown for the sake of clarity. As we mentioned when discussing red-black trees, the external nodes are rarely, if ever, actually implemented, but they can aid in the visualization of these types of structures and the operations that occur on them. Rather than implement external nodes, null pointers are typically utilized. Figure 3 illustrates the 7-way search tree of Figure 2 but with the external nodes represented. Multiway Trees - 1 Advanced Tree Structures – Multi-way Trees (7) M-way Search Tree An m-way search tree T is a general tree in which an ordering is imposed on the set of keys which reside in each node such that: 1. Each node has a maximum of m children between 1 and m-1 keys. 2. The keys in each node appear in ascending order. 3. The keys in the first i children are smaller than the i th key. 4. The keys in the last m-1 children are larger than the i th key.
Background image of page 1

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

View Full DocumentRight Arrow Icon
Figure 1. M-way search tree of order 4. Figure 2. M-way search tree of order 7. Multiway Trees - 2 50 60 80 30 35 58 59 52 54 61 62 55 56 57 100 63 70 73 10 80 5 2 3 4 32 36 20 30 40 50 60 70 82 84 86 88 90 92 94 96 98 10 80
Background image of page 2
Figure 3. M-way search tree of order 7 with external nodes shown. Figure 4. M-way search tree of order 7 shown with typical external node implementation. Justification for M-way Search Trees One common application for m-way search trees is the file system for secondary memory, such as disks and tapes, on computer systems. The basic unit of I/O transfer associated with a disk is a block. When information is read from a disk, the entire block, in which the information required is contained, is read into the memory (main memory) and when information is written from the main memory back to the secondary memory (the disk), the entire block is written back. Each time information is requested from a disk, the information must be located on the disk, the read/write head on the disk must be correctly
Background image of page 3

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

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

This document was uploaded on 06/13/2011.

Page1 / 18

mway7 - Advanced Tree Structures Multi-way Trees (7)...

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

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