In completing this assignment you MAY use/access the following resources:
You may NOT use/access:
- Resources not expressly listed above, including, but not limited to,
the following ...
- Source code not provided as part of this assignment. (Obviously, this
includes, but is not limited to, source code written by other students
whether current or in the past).
- Code-generating tools (of which ChatGPT is one example).
- Any web sites not directly linked to from the homework assignment.
Failure to abide by these guidelines will result in a zero for the assignment
and the incident will be reported to the university provost as a violation of
the university academic integrity policy. A second incident of academic
dishonesty (whether from this course or another computer science course) will
result in an F in the course.
This assignment is a continuation of lab day. Take a moment to re-read the
instructions regarding the goal of the assignment. Once you have completed all
of the steps outlined for lab day you will have a ArrayDictionary class
that loads words from a file into an array and sorts them (by sorted/anagram
word) using quicksort.
You recall that the program in the previous assignment took quite a while
to run on the large dictionary data file. When you consider that a modern
computer can do billions of operations a second, it sheds light on how many
steps our solution required the computer to perform!
One goal of this assignment is to make the program run faster by being more
efficient. You recall that binary search is touted as being significantly faster
than a sequential search. It is in preparation for using a binary search that we
put the elements into an array and then sorted them.
Suggested steps for completing this assignment:
- You'll probably want to use a small, hand-coded data file for
your initial testing.
- Write a binary search method according to the UML diagram in
the lab assignment. This search should be based on the compareTo()
method that compares the anagram/sorted words (same as was used to
sort the array). Test, document, commit.
- You will still have a countAnagrams() method as in the previous
assignment. This one, however will use as its first step a call to
the binary search method. Remember that in the newly sorted array, all
words that are anagrams of one another (members of the same
anagram family, so to speak) are adjacent to one another. So, when
the binary search method returns an index we don't know whether the
index will be at the beginning, end, or middle of the anagram family.
So, you'll need to do a sequential search moving up and down the array
starting from the provided index counting as you go until you reach a word
that is no longer an anagram match. Keep in mind that if the anagram
family appears at the beginning or end of the array you need to avoid
running off the front or back of the array as you count. Take some time
to really test this function. Once it is working, test, document, commit.
- Now you can write the showBigAnagramFamilies() method which
should be fairly straightfoward.
- Once everything is working you can switch to start using the large
data file. Test, document, commit, push.
The assignment will be graded according to the following criteria:
Correctness |
16 |
pts |
Documentation |
2 |
pts |
Conventions |
2 |
pts |
Version Control |
2 |
pts |
Total |
22 |
pts |
Your program should be completely working and should follow all of the
programming conventions named in class and explained in
http://josephus.hsutx.edu/classes/all/javaconventions/ (including the use
of comments that conform to the JavaDoc guidelines).
The instructor will grade your work based on what you have pushed to the hosted
homework repository you have shared. For all assignments the program is due
before the beginning of class on the due date. Repositories that show a commit
time after that time will be graded as late.