# computers

posted by .

How can you write a sorting algorithm for three intergers in simple english terms before it is translated into C?

• computers -

Do the three integers come in an array or in three distinct variables?

Can you clarify if the sorting algorithm should work for 3 (and no more) or is it a general algorithm that you are supposed to do?

A general one is not much more complicated, but requires the use of for-loops.

• computers -

For a general sorting using bubble sort (the simplest and the slowest):

N=number of items
A(i)=item i from array A

loop i from 1 to N-1
loop j from i+1 to N
if(A(i)>A(j)) exchange A(i) and A(j)
end loop j
end loop i

## Similar Questions

1. ### algebra

consider three consecutive even intergers, the least of which is x. Write a polnomial representing the product of these three intergers.(p+3)(p-4)(p-3)(p+4)

the sum of three intergers is 193.The smaller two are consecutive intergers and the larger two are consecutive even intergers.What are the three intergers?
3. ### computers:algorithm

Write a pseudocode to find the average of any amount of positive numbers.
4. ### computers

The recursive algorithm of the 4th Section of the chapter "Computational Geometry" employs a trick of presorting, in which we maintain two arrays X and Y of the input points P sorted on coordinate x and y, respectively. The algorithm …
5. ### Computers

Problem-Solving 1. Develop an algorithm or write pseudocode to determine if a citizen is eligible to vote. The criteria for eligibility are that the citizen must be 18 or older and must not be a convicted felon. The algorithm must …
6. ### computers

Write an algorithm, in English, to solve the following problem. Be sure to include pre- and post-conditions!
7. ### Math

I am a triangle that has been translated to rest on (-1, -1),(-1,3), and (-2,1). Before translation I was on (2,1) and (2,5). Where is my third vertex before I was translated?
8. ### English

Thank you very much! I still haven't found anything on biodiversity in water. I need to find a website which explains the possible scientific objectives of this type of topic. Remember that the research will be carried out by 17-year-old …
9. ### english

Write if the sentence is simple, compound,or complex. 1-I'd like to help you ;however,I am very busy today. complex 2-Do you know what Willie said.simple 3-I think that I've seen that movie before.simple 4-The person in the middle …
10. ### computer

Write an algorithm for a program that accepts a set of numbers and finds the smallest among them and computes the sum of the numbers accepted. The program stops when the user enters number 999. Convert the algorithm into flowchart

More Similar Questions