|PDF Title :
|Data Structures and Algorithms in Java
|Total Page :
|PDF Size :
|PDF Link :
Here on this page, we have provided the latest download link for Data Structures and Algorithms in Java PDF. Please feel free to download it on your computer/mobile. For further reference, you can go to Sams Publishing
Data Structures and Algorithms in Java – Book
To insert a new item in an indexed file, two steps are necessary. We first insert the item’s full record into the main file; then we insert an entry, consisting of the key and the block number where the new record is stored, into the index.
Because the index is in sequential order, to insert a new item, we need to move half the index entries, on average. Figuring 2 microseconds to move a byte in memory, we have 250,000 times 32 times 2, or about 16 seconds to insert a new entry. This compares with 5 minutes for the unindexed sequential file. (Note that we don’t need to move any records in the main file; we simply append the new record at the end of the file.)
Of course, you can use a more sophisticated approach to storing the index in memory. You could store it as a binary tree, 2-3-4 tree, or a red-black tree, for example. Any of these would significantly reduce insertion and deletion times. In any case, the index-in-memory approach is much faster than the sequential-file approach. In some cases, it will also be faster than a B-tree.
Data Structures and Algorithms in Java PDF
Know more about our initiative