algorithm - Difference between binary search tree and m-way tree -
Please explain the difference between binary search tree and m-tree?
Code> m + 1 link.
A binary tree is a special case of an M-tree, in which m is equal to one, which means only one node per node and two links (you either move left or right Or right link) is an example of a binary tree that shows:
+ ---- + | 20 | + ---- + / \ + ---- + + ---- + | 14 | | 23 + ---- + + ---- + An m-way tree may have multiple values per node, but the principle is still the same. You can choose which link to go down depending on the values, and m + 1 are possible options. An M-Tre tree (where m 2 is) can look like this Is:
+ ---- + ---- + | 17 | 30 | + ---- + ---- + ______ / | \ ______ / | \ + ---- + ---- + + ---- + ---- + ---- + ---- + | 11 | 15 | | 19 | 28 | | 33 | 34 + ---- + ---- + + ---- + + ---- + ---- + ---- + These are M-trees Often used in situations where you can fit more than one value into an efficient block. For example, let's say:
For example, this means that:
- A disk block is 512 bytes;
- Value in your tree takes 122 bytes; And
- Links take 4 bytes.
In this situation, you can fit 4 values into a disk block, this type is calculated:
numbers = intestine / (Values + Linux) = Int ((512-4) / (122 + 4)) = Int (508/126) = int (4.0317) = 4 This gives you 508 bytes Gives four values and five links for:
4 * 122 = 488 5 * 4 = 20 --- 508 Although some wastage (this In case there are four bytes), one of the values in each efficiently retrievable block on it There is the benefit of accumulating an integral number.
Comments
Post a Comment