File System

Explain the data structures and algorithms that you would use to design an in-memory file system. Illustrate with an example in code where possible.

Solution

Files and Directories. Each Directory contains a set of Files and Directories.

  • abstract class Entry
  • class File extends Entry
  • class Directory extends Entry

具体的操作,根据和面试官的讨论找着写就行了