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

Don't use plagiarized sources. Get Your Custom Essay on
Algorithms and Data Structures
Just from $13/Page
Order Essay
Calculate your order
275 words
Total price: $0.00

Top-quality papers guaranteed

54

100% original papers

We sell only unique pieces of writing completed according to your demands.

54

Confidential service

We use security encryption to keep your personal data protected.

54

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

  1. Title page

    We offer you a free title page tailored according to the specifics of your particular style.

  2. Custom formatting

    Include your preferred formatting style when you order from us to accompany your paper.

  3. Bibliography page

    Get a list of references to go with your ordered paper.

  4. 24/7 support assistance

    Reach out to our support agents anytime for free assistance.

Calculate how much your essay costs

Type of paper
Academic level
Deadline
550 words

How to place an order

  • Choose the number of pages, your academic level, and deadline
  • Push the orange button
  • Give instructions for your paper
  • Pay with PayPal or a credit card
  • Track the progress of your order
  • Approve and enjoy your custom paper

Ask our experts to write you a cheap essay of excellent quality

Place an order