Question: 1 public static void sort(ArrayList list) 2 { 3 for (int start = 0; start < list.size(); start++) 4 { 5 int mInd = start;

1 public static void sort(ArrayList list) 2 { 3 for (int start = 0; start < list.size(); start++) 4 { 5 int mInd = start; 6 for (int j = start; j < list.size(); j++) 7 { 8 if (list.get(j) < list.get(mInd)) 9 { 10 mInd = j; 11 } 12 } 13 list.add(start, list.remove(mInd)); 14 } 15 } 

Suppose the following comments to describe what the code does were to be added.

  1. // Iterate through indices of remaining unsorted list
  2. // Move minimum element from remaining list to the start

At which lines should these comments be inserted?

I - line 8, II - line 13

I - line 6, II - line 13

I - line 3, II - line 13

I - line 3, II - line 10

I - line 6, II - line 10

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!