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
Get step-by-step solutions from verified subject matter experts
