Algorithms and Data Structures
Algorithms and Data StructuresAssignment – Generalized TreesIntroductionThe file system on most modern operating systems is organized as a generalized tree structure. The nodes of the tree are regular files and subdirectories. The subdirectories provide hierarchical structure, as they can contain other subdirectories as well as regular files.For this assignment, write a Java program that recursively traverses the file system starting at a fully qualified subdirectory. The subdirectory must be provided as a command line parameter. When processing begins, the first line of output is the fully qualified subdirectory.For each subdirectory encountered, get a list of the files in that subdirectory. For each entry in the list, if it is a regular file, output the file name and extension. Do not include the path name; just the file name and extension. If the file is a subdirectory, output just the subdirectory name; do not include the pathname that precedes the subdirectory name. In either case, after outputting the name, recursively descend into subdirectory and continue. You may recognize this as a pre-order traversal.For each line of output, prefix the file or subdirectory name with indentation that provides a visual indication of the depth of the recursive descent.Students are responsible for· public FileTreeWalk(String pathname)· public String listAllFiles()· public String toString()class FileTreeWalkFileTreeWalk is a Java class used for traversing a file system. In addition to a constructor, the class provides two public methods for traversing the file system, and a public toString method for displaying the traversal results.The public interface to the class follows:public FileTreeWalk (String pathname)The constructor takes a String parameter that specifies a pathname. The pathname is a starting point for the file system traversal. The parameter is either a fully qualified path name, or a relative pathname. Fully qualified pathnames start with an optional drive letter, or a slash. On other operating systems (e.g., Linux, Unix), a fully qualified pathname starts with a slash. Relative pathnames start at the current working directory. In either case, the pathname parameter specifies where the file system traversal is supposed to begin.As FileTreeWalk traverses the file system, it adds file names and subdirectory names to a generalized tree structure that when finished will represent the current state of the file system from the starting point specified by the String parameter, pathname.public String listAllFiles ()For more information on Algorithms and Data Structures check on: https://en.wikipedia.org/wiki/List_of_data_structures
Top-quality papers guaranteed
100% original papers
We sell only unique pieces of writing completed according to your demands.
Confidential service
We use security encryption to keep your personal data protected.
Money-back guarantee
We can give your money back if something goes wrong with your order.
Get free features with our reliable essay writing service
-
Title page
We offer you a free title page tailored according to the specifics of your particular style.
-
Custom formatting
Include your preferred formatting style when you order from us to accompany your paper.
-
Bibliography page
Get a list of references to go with your ordered paper.
-
24/7 support assistance
Reach out to our support agents anytime for free assistance.
Calculate how much your essay costs
What we are popular for
- English 101
- History
- Business Studies
- Management
- Literature
- Composition
- Psychology
- Philosophy
- Marketing
- Economics