we wish to store a large set of keyed data items where each item's key is the name of a ship Let's call this data item a Ship.
Each Ship item also stores numerous other data fields beside, ship's name which describes other properties of the ship, such as the number of sacks of grain that can be stored in the ship hold, the number of sacks currently in the ship hold, a list of the names of each member of the crew and their percentage share of the booty.
further suppose that the captain, does not keep all of his ships clustered together
in a single group in order to avoid detection. Instead, the captain keeps his ships grouped into multiple separate groups of ships called task forces.
Task 2)
Assume that primary purpose for storing these Ship keyed data items is to be able
to look up which task force a ship is in. In own words,
tell advantages and disadvantages (if any) for each JAVA ADTs
. Hash table
. Graph
. AVL Tree/BST tree
. Union-find/Disjointed data
which ADTs is best choice for this purpose, why.
Hash Table
Advantages of Hash table
Disadvantages of Hash Table
Graph
Advantages of graph
Disadvantages of graph
AVL Tree/BST tree
Advantage of AVL Tree/BST tree
Demerit of AVL Tree/BST tree
Union-find/Disjointed data
Advantage of Union-find/Disjointed data
Disadvantage
Difficulty in implementation
The suitable and appropriate ADT to use in the purpose described is the hash table. Hash tables allow synchronization, hence the ship key data items will be synchronized easily. Hash tables also possesses faster and efficient creation and deletion of the stored data.
Comments
Leave a comment