How do I build a tree from categories of hurricanes and answer queries on the tree in java with a Tree class that has a linked structure of tree nodes and supports (at least) the following operations: • addChild(parentNode, childNode) // to maintain alphabetical/lexicographical order of the children • getChildren(node) • getParent(node) For each node, you may not assume it has a fixed or maximum number of children. Input: Input is from the command-line arguments in this order: 1. the first line has the top cateogory (hurricanes), followed by its sub-categories (e.g. cat1, cat2); each of the following lines has a category, followed by its sub-categories. 2. each line has one of the following queries: • GetNamesByCategory category • GetNamesByState state • GetNamesByCategoryAndState category state • GetNamesWithMultipleStates • GetNamesWithMultipleCategories • GetCategory name • GetState name You may assume each query is valid (name, category, and state exist in the data), but some queries do not have results. Output: Output goes to the standard output (screen), each line has an answer with the corresponding query: • GetNamesByCategory category name1 name2 ... • GetNamesByState state name1 name2 ... • GetNamesByCategoryAndState category state name1 name2 ... • GetNamesWithMultipleStates name1 name2 ... • GetNamesWithMultipleCategories name1 name2 ... • GetCategory name category1 ... • GetState name state1 ... 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.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question


How do I build a tree from categories of hurricanes and answer queries on the tree in java with a Tree class that has a linked structure of tree nodes and supports (at least) the following operations:
• addChild(parentNode, childNode) // to maintain alphabetical/lexicographical order of the children
• getChildren(node)
• getParent(node)
For each node, you may not assume it has a fixed or maximum number of children.
Input: Input is from the command-line arguments in this order:
1. the first line has the top cateogory (hurricanes), followed by its sub-categories (e.g. cat1, cat2);
each of the following lines has a category, followed by its sub-categories.
2. each line has one of the following queries:
• GetNamesByCategory category
• GetNamesByState state
• GetNamesByCategoryAndState category state
• GetNamesWithMultipleStates
• GetNamesWithMultipleCategories
• GetCategory name
• GetState name
You may assume each query is valid (name, category, and state exist in the data), but some queries do not have results.
Output: Output goes to the standard output (screen), each line has an answer with the corresponding query:
• GetNamesByCategory category name1 name2 ...
• GetNamesByState state name1 name2 ...
• GetNamesByCategoryAndState category state name1 name2 ...
• GetNamesWithMultipleStates name1 name2 ...
• GetNamesWithMultipleCategories name1 name2 ...
• GetCategory name category1 ...
• GetState name state1 ...
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.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Knowledge Booster
Binomial Heap
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education