Asked by su
                How can you write a sorting algorithm for three intergers in simple english terms before it is translated into C? 
            
            
        Answers
                    Answered by
            MathMate
            
    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.
    
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.
                    Answered by
            MathMate
            
    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
    
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
                                                    There are no AI answers yet. The ability to request AI answers is coming soon!
                                            
                Submit Your Answer
We prioritize human answers over AI answers.
If you are human, and you can answer this question, please submit your answer.