Question: Recall the StringBag class from the Week 9 homework assignment. You will be writing methods to sort the Strings. a. [4 points] Write a function

Recall the StringBag class from the Week 9 homework assignment. You will be writing methods to sort the Strings. a. [4 points] Write a function that sorts the Strings in ascending alphabetical order. Identify your algorithm in the comments in the code. i. Write your test case for this method. @Test public void testSortAscending() { StringBag bag = new StringBag(); // add() and indexOf() are methods of previous HW } ii. Write your method. public void sortAscending() { // an insertion sort, but bubble or selection also work } b. [4 points] Write a function that sorts the Strings in descending alphabetical order. Identify your algorithm in the comments in the code. i. Write your test case for this method. @Test public void testSortDescending() { } ii. Write your method. public void sortDescending() { }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!