Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Automating Access Databases With Macros

Authors: Fish Davis

1st Edition

1797816349, 978-1797816340

More Books

Students also viewed these Databases questions

Question

Stages of a Relationship?

Answered: 1 week ago