Many entities, such as hurricanes, can be organized in a hierarchy. How would you design a system that stores the hierarchy and allow queries on the hierarchy?
The goal of HW3 is to build a tree from categories of hurricanes and answer queries on the tree. Your submission has a Tree class that has a linked structure of tree nodes and supports (at least) the following operations:
For each node, you may not assume it has a fixed or maximum number of children.
Input: Input is from the command-line arguments for hw3.c (HW3.java) in this order:
1. filename of the datathe first line has the top category, followed by its sub-categories; each of the following lines has a category, followed by its sub-categories.
2. filename of queries, each line has one of the following queries:
You may assume each query is valid (name, category, and state exist in the data), but some queries do not have results. Sample input files are on the course website.
Output: Output goes to the standard output (screen), each line has an answer with the corresponding query:
Note that a hurricane can create hurricane conditions in more than one state in different categories, so GetState/GetCategory might have more than one state/category and getNames should not have duplicates. All results should be alphabeti- cally/lexicographically ordered. Report "none" if there are no results.