Thursday, July 9, 2009

Sorting using Array in C++?

How to Sort three numbers using Array in C++?





Let say input 3 number which looks like this:





Input Number 1: 5


Input Number 2: 4


Input Number 3: 7





and the output will became: 457





anyone?

Sorting using Array in C++?
So what you want to do is sort from smallest to largest? That's fairly routine. However, in case this is a homework question, I will refer you to "Algorithms in C++" by Sedgewick, and give you a web page that might help - http://www.cs.sunysb.edu/~algorith/files...





If you're dealing with a dataset that's not too large and efficiency isn't an issue, I'd recommend going with a binary sort for simplicity.


No comments:

Post a Comment