Answer to Question #227861 in Java | JSP | JSF for Zia

Question #227861

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.


1
Expert's answer
2021-08-22T00:27:32-0400

Hash Table

Advantages of Hash table

  • Main merit of hash table is synchronization; therefore, keyed data of the ship will be synchronized easily.
  • Efficient than search trees as they provide an effective way for creating, looking, and deleting the stored data.

Disadvantages of Hash Table

  • The unavoidable hash collisions.
  • Hash table does not allow the usage of null values.

Graph

Advantages of graph

  • Needs little or explanation to understand.
  • Can work with large range of data

Disadvantages of graph

  • Exact values are not revealed in graph
  • Inefficient in deleting and looking up the stored data.

AVL Tree/BST tree

Advantage of AVL Tree/BST tree

  • It has low time complexity for operations such as deletion and insertion of data.
  • Easy to implement

Demerit of AVL Tree/BST tree

  • Deletion operation can be very difficult in AVL trees as deletion requires many rotations and pointer changes.

Union-find/Disjointed data

Advantage of Union-find/Disjointed data

  • Can represent large volume of 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.


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS