Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Code in Java, wirhout the use of hasmaps please!! Problem set #4 Due: Wednesday Feb. 15, 1:00 pm. Relevant topics: asymptotic analysis, lists. An anagram

Code in Java, wirhout the use of hasmaps please!! image text in transcribed
Problem set \#4 Due: Wednesday Feb. 15, 1:00 pm. Relevant topics: asymptotic analysis, lists. An anagram is a word obtained by reordering the letters of another word. For example, "once" and "cone" are anagrams. Note that each letter must be reused exactly once, so anagrams must have the same number of letters. Which word in the English language has the most anagrams? As in the last assignment, let us take "words" to mean words in the file "words.txt". Write a program called MostAnagrams to find the length of a word with the most anagrams. The input to your program is a single line containing a single positive integer n, which is the maximum number of lines to read from words.txt. Your program should print a single integer, the maximum number of anagrams of the words in the first n lines of words.txt. (If n is greater than the number of lines in words.txt, then the output is the same as for n equal to the number of lines in words.txt.) For example, if the input is 8,000 , then a correct output is 5, since albas baals balas balsa basal is the largest set of anagrams in the first 8,000 lines of words.txt. For this problem you may find the String method toChar Array (), the String constructor that takes a character array argument, and the method java.util.Arrays.sort useful. You may also use the Collections.sort() method. You can assume that Collections.sort,( sorts a list of n objects in time O(nlgn). Your program must run in time O(nlgn). Upload your program to Vocareum

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle 10g Database Administrator Implementation And Administration

Authors: Gavin Powell, Carol McCullough Dieter

2nd Edition

1418836656, 9781418836658

More Books

Students also viewed these Databases questions