How do I develop an algorithm?

How would you develop an algorithm arranging a set of numbers in ascending order?

  • Answer:

    The easies way is with 2 loops. In the second loop you just check if the number you are currently on is smaller than the number the first loop points at and if that is the case you just switch their places.

6KBGDORUK2YUDZOL4I5LG6RSH4 at Yahoo! Answers Visit the source

Was this solution helpful to you?

Other answers

The main way that I develop an algorithm is to think about what I'm trying to accomplish and how I can use the tools I know to make it work. Then I have to decide if there is a way to improve the algorithm, or maybe conclude that it's good enough and not worth the time to try and make it better. I never have to think about an algorithm for arranging a set of numbers in ascending order because I know such algorithms have already been developed.

EddieJ

That's called Bubble Sort and it's extremely slow, but the easiest to understand and implement. A shell sort or quick sort would be much faster. Google it.

Jo Han

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.