Question: Please help me with this assignment: Working with arrays and strings This exercise gets you work with arrays and strings. Remember that a string is

Please help me with this assignment:
Working with arrays and strings
This exercise gets you work with arrays and strings. Remember that a string is an array of
characters.
0. Get set up
Duplicate the Visual Studio files you need and start up Visual Studio.
1. Read in and sort a string
You are to write a program that inputs a string, sorts the characters in it, and outputs it. This is
a lot like a previous exercise you wrote, but (a) you must use a string, and (b) you must use a
Selection sort.
Some things to be aware of:
Start with your that used the Bubble sort. However, you need to compute the length of
the string (before, we assumed a length).
Be aware of the size of the data you are working with. A character is a byte, while the
ECX is a 32-bit word. Copying something that is a byte into the ECX will also copy 3
bytes that follow it.
Remember the Selection sort. In Java:
void selectionSort(int arr[]){
int n = arr.length;
for (int i =0; i < n-1; i++){
// Find the minimum element in unsorted array
int min_idx = i;
for (int j = i+1; j < n; j++)
if (arr[j]< arr[min_idx])
min_idx = j;
// Swap the found minimum element with the first
// element
int temp = arr[min_idx];
arr[min_idx]= arr[i];
arr[i]= temp;
}
}

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!