Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Java 1 Marks Question Four Supposeyou are to develop an indexing application wit

ID: 3715304 • Letter: J

Question

Java

1 Marks Question Four Supposeyou are to develop an indexing application with the following conditions: 1- Input: A document (i.e., a web page) with a known number of words 2- Output: An index corresponding to the words of the document and their frequencies. An example would be the portionin the figure below, which is extracted from the SEU main page. The following is the IDs for the words mentioned in the above portion: 28-05-1439 (ACTFL) experts visit the Saudi Electronic University to review and develop the Arabic Online Program and the Standardized Arabic 14 Experts.. Arabic Standardized 2 The outputindex consists of two integers separated by a colon. The index for the word "Arabic" is 11:2. The first number before the colon represents the word's ID, and the second number is the word's frequency (means, telling how many times the word has occurred in the document) Which data structure would you select for your solution? Give 2 reasons to justify your answer?

Explanation / Answer

I would use Map<String, Map<Integer,Integer>>

Key is String which will hold words.

Value is another Map whose key is Integer which represents index of the word and value is another integer which represents the frequency.

Why?

1. Constant access - Map provides constnat access for get.

2. Using Treemap will gives us lexicographically ordered storage.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote