Posted by Mark on Friday, October 12, 2007 at 7:16am.
Most computer languages have a command that assigns a numerical value to a character variable, such as VAL($A) in Visual Basic.
I used to assign such a problem as you stated and found the "bubble method" to be the easiest to use for most students.
Assign your data into an array of 30 subscripted string variables.
Assign the first string variable as $large.
Set up a loop that runs from 1 to 30, or n, comparing each item to $large.
if the item is less than or equal to VAL($large) keep going in the loop, if the item is greater then assign its value to $large. Keep track of where you found the largest with a variable.
At the end of the first loop, the largest value,(the highest name in your alpha list) will be exchanged with the last entry, and that last entry will be placed in the position where $large was found.
Repeat the loop from 1 to 29, or n-1, the second largest will now be in the second last position etc.
Related Questions
Math Statistics - The sorting algorithm known as bogosort can be described in ...
computer science - Declare a structure whose tag name is Emp and that contains ...
Programming - 2. Then it should prompt the user for the input file name of the ...
Simple Array Process - need help with this generate only the pseudocode. No ...
Computer Science - Can anyone please write a basic c++ code for the following ...
python 3 - For this option, first ask the user how many items there will be. (&...
college - Write a C++ program to fill an array with 6 numbers, and then reverse...
CIS/Visual Logic - Design an application that accepts 10 numbers and displays ...
Computer Science - An advertising agency wants to send a letter to all of its ...
math - don break a 4x7 array into a 2x7 array and another array. what is the ...
For Further Reading