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
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:
- How many regions are created by the set of all hyperplanes defined by a set of points?Best solution by Mathematics
- How to arrange a set of number?Best solution by math.stackexchange.com
- How much do a set of golf clubs weigh?Best solution by Yahoo! Answers
- How to connect a video recorder to a set top box?Best solution by Yahoo! Answers
- How can I develop a customer base for selling cars?Best solution by briantracy.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
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.