You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
LECTURE NOTES OF ADVANCED DATA STRUCTURE (MT-CSE 110)<br />
each block. For internal blocks, space saving can be achieved by either<br />
compressing keys or pointers. For string keys, space can be saved by <strong>using</strong> the<br />
following technique: Normally the ith entry of an internal block contains the<br />
first key of block i+<strong>1.</strong> Instead of storing the full key, we could store the shortest<br />
prefix of the first key of block i+1 that is strictly greater (in lexicographic order)<br />
than last key of block i. There is also a simple way to compress pointers: if we<br />
suppose that some consecutive blocks i, i+<strong>1.</strong>..i+k are stored contiguously, then it<br />
will suffice to store only a pointer to the first block and the count of consecutive<br />
blocks.<br />
All the above compression techniques have some drawbacks. First, a full block<br />
must be decompressed to extract a single element. One technique to overcome<br />
this problem is to divide each block into sub‐blocks and compress them<br />
separately. In this case searching or inserting an element will only need to<br />
decompress or compress a sub‐block instead of a full block. Another drawback<br />
of compression techniques is that the number of stored elements may vary<br />
considerably from a block to another depending on how well the elements are<br />
compressed inside each block.<br />
Deletion<br />
Before presenting pseudocode we provide a basic flowchart and algorithm to<br />
illuminate its function. Figure 1 shows how the initial downwards recursive<br />
search is followed by an upwards unwinding of the recursion, during which the<br />
deletion, and potentially the rebalancing of the tree, takes place. The second<br />
phase corresponds to the shaded area of the figure. A set of immediate<br />
neighbors and anchors, defined below, is calculated during the search phase, for<br />
use during the tree rebalancing.<br />
The algorithm outline is as follows:<br />
<strong>1.</strong> recurse to a leaf node from root to find deletable entry: for nodes in the<br />
search path, calculate immediate neighbors and their anchors.<br />
2. if entry found at leaf node continue else stop<br />
3. remove appropriate entry fiom current node<br />
Prepared By :<br />
Er. Harvinder Singh<br />
Assist Prof., CSE, H.C.T.M (Kaithal) Page ‐ 223 ‐