17.17 |
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.) |
17.18 |
Modify the ExternalSort program so that it sorts files of ints (in binary format) rather than lines of text. |
17.19 |
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
Encapsulation
Polymorphism
Inheritance
Part II: Linear Structures
Stacks and Queues
Array-Based Structures
Linked Structures
Part III: Algorithms
Analysis of Algorithms
Searching and Sorting
Recursion
Part IV: Trees and Sets
Trees
Sets
Part V: Advanced Topics
Advanced Linear Structures
Strings
Advanced Trees
Graphs
Memory Management
Out to the Disk
Part VI: Appendices
A. Review of Java
B. Unified Modeling Language
C. Summation Formulae
D. Further Reading
Index