Question
convert this into high level pseudo code?? A. public void iterativeSort(int[] list) { int i, j, min, temp; for (i = 0; i < list.length;
convert this into high level pseudo code??
A. public void iterativeSort(int[] list) { int i, j, min, temp; for (i = 0; i < list.length; i++) { min = i; for (j = i + 1; j < list.length; j++) { if (list[j] < list[min]) min = j; } if (min != i) { Count++; temp = list[i]; list[i] = list[min]; list[min] = temp; } } }
B. public void recursiveSort(int[] list, int start) { if ( start >= list.length - 1 ) return; int min; min = start; for ( int index = start + 1; index < list.length; index++ ) { if (list[index] < list[min] ) min = index; } if (start != min) { Count++; int temp; temp = list[start]; list[start] = list[min]; list[min] = temp; } recursiveSort(list, start + 1); }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Sure here is code A iterativeSortlist Count 0 for i from 0 to length of list 1 min ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started