Write a program that, given a directory, lists the contents of that directory and any subdirectories. The output should be nicely formatted, with files deeper in the directory structure indented farther. (Hint: Look at the API for the File class.)


Modify the ExternalSort program so that it sorts files of ints (in binary format) rather than lines of text.


There is a subtle flaw in the IdGenerator class (Figure 17-44): if we use it many times, the counter in the file will "wrap around" to negative numbers, and then back to 0. Eventually it will begin handing out ids that have been generated before and that might still be in use. Modify the class to keep a set of in-use ids in the file. The nextId() method should never return an in-use id. Modify the deleteFromDisk() method of the BTreeNode class to inform the IdGenerator when an id number is no longer in use.

Part I: Object-Oriented Programming




Part II: Linear Structures

Stacks and Queues

Array-Based Structures

Linked Structures

Part III: Algorithms

Analysis of Algorithms

Searching and Sorting


Part IV: Trees and Sets



Part V: Advanced Topics

Advanced Linear Structures


Advanced Trees


Memory Management

Out to the Disk

Part VI: Appendices

A. Review of Java

B. Unified Modeling Language

C. Summation Formulae

D. Further Reading


Data Structures and Algorithms in Java
Data Structures and Algorithms in Java
ISBN: 0131469142
EAN: 2147483647
Year: 2004
Pages: 216
Authors: Peter Drake

Similar book on Amazon © 2008-2020.
If you may any questions please contact us: